summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjperkin <jperkin@pkgsrc.org>2014-10-08 10:04:45 +0000
committerjperkin <jperkin@pkgsrc.org>2014-10-08 10:04:45 +0000
commit13f38a2147205031c1e73574c73264a5b780437c (patch)
tree9d2bcb897fc25adc224b9225af234714bfc85bbe /mk
parent1f98fc5d58e9949fdb18938c2093a8cc945f1400 (diff)
downloadpkgsrc-13f38a2147205031c1e73574c73264a5b780437c.tar.gz
Add missing braces and check getline returns success, this code must have
worked by pure luck in the past, and now works with strict POSIX awk too.
Diffstat (limited to 'mk')
-rwxr-xr-xmk/pkgformat/pkg/reduce-depends.awk5
1 files changed, 3 insertions, 2 deletions
diff --git a/mk/pkgformat/pkg/reduce-depends.awk b/mk/pkgformat/pkg/reduce-depends.awk
index be732f18376..a293e4fe077 100755
--- a/mk/pkgformat/pkg/reduce-depends.awk
+++ b/mk/pkgformat/pkg/reduce-depends.awk
@@ -1,6 +1,6 @@
#!/usr/bin/awk -f
#
-# $NetBSD: reduce-depends.awk,v 1.2 2013/05/12 05:24:28 obache Exp $
+# $NetBSD: reduce-depends.awk,v 1.3 2014/10/08 10:04:45 jperkin Exp $
#
# Copyright (c) 2006 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -84,13 +84,14 @@ BEGIN {
cmd = TEST " -d " dir
if (system(cmd) == 0) {
cmd = "cd " dir " && " PWD_CMD
- while (cmd | getline pkgpath)
+ while ((cmd | getline pkgpath) > 0) {
if (!(pkgpath in pkgsrcdirs)) {
pkgpaths[P++] = pkgpath
pkgsrcdirs[pkgpath] = dir
}
depends[pkgpath, 0]++;
depends[pkgpath, depends[pkgpath, 0]] = pattern
+ }
close(cmd)
} else {
print "ERROR: [" PROGNAME "] " dir " does not exist." | ERRCAT