]> granicus.if.org Git - procps-ng/commitdiff
sysctl return value
authorCraig Small <csmall@enc.com.au>
Sat, 6 Apr 2013 23:30:59 +0000 (09:30 +1000)
committerCraig Small <csmall@enc.com.au>
Sat, 6 Apr 2013 23:30:59 +0000 (09:30 +1000)
Gilles brought up a warning message in sysctl.c
sysctl.c: In function 'main':
sysctl.c:767: warning: value computed is not used

The return value of Preload was not being applied correctly to ret
meaning sysctl would not return the correct value.

Reference: http://www.freelists.org/post/procps/procpsng-337,18

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

index 075687886786624a705577eacf5a551e41be39f1..81d697e736d0c875f15f4722b0aea9cdf76d03e1 100644 (file)
--- a/sysctl.c
+++ b/sysctl.c
@@ -764,15 +764,15 @@ int main(int argc, char *argv[])
                int ret = EXIT_SUCCESS, i;
                if (!preloadfile) {
                        if (!argc) {
-                               ret != Preload(DEFAULT_PRELOAD);
+                               ret |= Preload(DEFAULT_PRELOAD);
                        }
                } else {
                        /* This happens when -pfile option is
                         * used without space. */
-                       Preload(preloadfile);
+                       ret |= Preload(preloadfile);
                }
                for (i = 0; i < argc; i++)
-                       Preload(argv[i]);
+                       ret |= Preload(argv[i]);
                return ret;
        }