]> granicus.if.org Git - procps-ng/commitdiff
0122-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>
Sat, 23 Jun 2018 11:59:14 +0000 (21:59 +1000)
Luckily, EOF is usually -1, but this is not guaranteed by the standard.

Signed-off-by: Craig Small <csmall@enc.com.au>
vmstat.c

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