[BusyBox] Killall: fixed exit status

Pavel Roskin pavel_roskin at geocities.com
Tue Jun 6 17:29:23 UTC 2000


Hello!

The normal "killall" exits with the status 1 if at least one of the
processes has not been found by name.

Changelog:
	* Fixed exit status for killall - Pavel Roskin

Regards
Pavel Roskin

=======================
diff -u -r1.5 kill.c
--- kill.c	2000/06/02 13:50:24	1.5
+++ kill.c	2000/06/06 17:22:27
@@ -228,14 +228,17 @@
 	} 
 #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 @@
 			 * upon exit, so we can save a byte or two */
 			argv++;
 		}
+		exit (all_found);
 	}
 #endif
 
=======================






More information about the busybox mailing list