summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorEric Andersen2002-09-16 06:22:25 +0000
committerEric Andersen2002-09-16 06:22:25 +0000
commitc38678d14b87f8e2d4f0d610d0aa61c656f17539 (patch)
tree8a08f41faae7672a634f32234dee4b5308cda39c /procps
parent166fa4684f33579277f34d887537c2abefc9deb0 (diff)
downloadbusybox-c38678d14b87f8e2d4f0d610d0aa61c656f17539.zip
busybox-c38678d14b87f8e2d4f0d610d0aa61c656f17539.tar.gz
Apply vodz' last_patch52
Diffstat (limited to 'procps')
-rw-r--r--procps/kill.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/procps/kill.c b/procps/kill.c
index 5f2f661..2ef87ae 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -40,6 +40,7 @@ extern int kill_main(int argc, char **argv)
{
int whichApp, sig = SIGTERM, quiet;
const char *name;
+ int errors = 0;
#ifdef CONFIG_KILLALL
/* Figure out what we are trying to do here */
@@ -111,37 +112,33 @@ do_it_now:
perror_msg_and_die( "Bad PID");
pid = strtol(*argv, NULL, 0);
if (kill(pid, sig) != 0) {
- perror_msg_and_die( "Could not kill pid '%d'", pid);
+ perror_msg( "Could not kill pid '%d'", pid);
+ errors++;
}
argv++;
}
+
}
#ifdef CONFIG_KILLALL
else {
- int all_found = TRUE;
pid_t myPid=getpid();
/* Looks like they want to do a killall. Do that */
while (--argc >= 0) {
long* pidList;
- pidList = find_pid_by_name( *argv);
+ pidList = find_pid_by_name(*argv);
if (!pidList || *pidList<=0) {
- all_found = FALSE;
- if (quiet) {
- exit(EXIT_FAILURE);
+ errors++;
+ if (quiet==0)
+ error_msg( "%s: no process killed", *argv);
} else {
- error_msg_and_die( "%s: no process killed", *argv);
- }
- }
-
- for(; pidList && *pidList!=0; pidList++) {
+ for(; *pidList!=0; pidList++) {
if (*pidList==myPid)
continue;
if (kill(*pidList, sig) != 0) {
- if (quiet) {
- exit(EXIT_FAILURE);
- } else {
- perror_msg_and_die( "Could not kill pid '%d'", *pidList);
+ errors++;
+ if (quiet==0)
+ perror_msg( "Could not kill pid '%d'", *pidList);
}
}
}
@@ -150,10 +147,7 @@ do_it_now:
* upon exit, so we can save a byte or two */
argv++;
}
- if (! all_found)
- return EXIT_FAILURE;
}
#endif
-
- return EXIT_SUCCESS;
+ return errors;
}