Fixed exit status for killall
authorPavel Roskin <proski@gnu.org>
Tue, 6 Jun 2000 18:10:17 +0000 (18:10 -0000)
committerPavel Roskin <proski@gnu.org>
Tue, 6 Jun 2000 18:10:17 +0000 (18:10 -0000)
Changelog
kill.c
procps/kill.c

index 7ac97dc71cbd1ef2dbb79f734b838ee0c892cf4c..da229a962667281e54aecac11e0db8a332cc6c62 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -59,6 +59,7 @@
            with traditional implementations -- Pavel Roskin.
        * "mount" now reports errors from nfsmount() and assumes NFS mount
            if ':' is present in the device name - Pavel Roskin
+       * Fixed exit status for killall - Pavel Roskin
        * More doc updates
 
 
diff --git a/kill.c b/kill.c
index 1f1bee48bef51855ba021bf27fd4ab26e4881fc5..75277d9626c42b073a65421ac84ed08503ca8ce7 100644 (file)
--- a/kill.c
+++ b/kill.c
@@ -228,14 +228,17 @@ extern int kill_main(int argc, char **argv)
        } 
 #ifdef BB_KILLALL
        else {
+               int all_found = TRUE;
                pid_t myPid=getpid();
                /* Looks like they want to do a killall.  Do that */
                while (--argc >= 0) {
                        pid_t* pidList;
 
                        pidList = findPidByName( *argv);
-                       if (!pidList)
+                       if (!pidList) {
+                               all_found = FALSE;
                                errorMsg( "%s: no process killed\n", *argv);
+                       }
 
                        for(; pidList && *pidList!=0; pidList++) {
                                if (*pidList==myPid)
@@ -248,6 +251,7 @@ extern int kill_main(int argc, char **argv)
                         * upon exit, so we can save a byte or two */
                        argv++;
                }
+               exit (all_found);
        }
 #endif
 
index 1f1bee48bef51855ba021bf27fd4ab26e4881fc5..75277d9626c42b073a65421ac84ed08503ca8ce7 100644 (file)
@@ -228,14 +228,17 @@ extern int kill_main(int argc, char **argv)
        } 
 #ifdef BB_KILLALL
        else {
+               int all_found = TRUE;
                pid_t myPid=getpid();
                /* Looks like they want to do a killall.  Do that */
                while (--argc >= 0) {
                        pid_t* pidList;
 
                        pidList = findPidByName( *argv);
-                       if (!pidList)
+                       if (!pidList) {
+                               all_found = FALSE;
                                errorMsg( "%s: no process killed\n", *argv);
+                       }
 
                        for(; pidList && *pidList!=0; pidList++) {
                                if (*pidList==myPid)
@@ -248,6 +251,7 @@ extern int kill_main(int argc, char **argv)
                         * upon exit, so we can save a byte or two */
                        argv++;
                }
+               exit (all_found);
        }
 #endif