]> granicus.if.org Git - procps-ng/commitdiff
vmstat: getopt*() returns -1 when done, not EOF.
authorQualys Security Advisory <qsa@qualys.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
committerCraig Small <csmall@enc.com.au>
Wed, 13 Jun 2018 12:05:57 +0000 (22:05 +1000)
Luckily, EOF is usually -1, but this is not guaranteed by the standard.

vmstat.c

index f2aa2f46af7c1c0bc102f6baf6083dc42d7dbe0b..6eca2c452cf6cc6a94aa4af70a4cee36a3a73c2c 100644 (file)
--- a/vmstat.c
+++ b/vmstat.c
@@ -878,7 +878,7 @@ int main(int argc, char *argv[])
 
        while ((c =
                getopt_long(argc, argv, "afmnsdDp:S:wthV", longopts,
-                           NULL)) != EOF)
+                           NULL)) != -1)
                switch (c) {
                case 'V':
                        printf(PROCPS_NG_VERSION);