diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-09-16 06:22:25 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-09-16 06:22:25 +0000 |
commit | c38678d14b87f8e2d4f0d610d0aa61c656f17539 (patch) | |
tree | 8a08f41faae7672a634f32234dee4b5308cda39c /procps | |
parent | 166fa4684f33579277f34d887537c2abefc9deb0 (diff) | |
download | busybox-w32-c38678d14b87f8e2d4f0d610d0aa61c656f17539.tar.gz busybox-w32-c38678d14b87f8e2d4f0d610d0aa61c656f17539.tar.bz2 busybox-w32-c38678d14b87f8e2d4f0d610d0aa61c656f17539.zip |
Apply vodz' last_patch52
Diffstat (limited to 'procps')
-rw-r--r-- | procps/kill.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/procps/kill.c b/procps/kill.c index 5f2f6618f..2ef87aea6 100644 --- a/procps/kill.c +++ b/procps/kill.c | |||
@@ -40,6 +40,7 @@ extern int kill_main(int argc, char **argv) | |||
40 | { | 40 | { |
41 | int whichApp, sig = SIGTERM, quiet; | 41 | int whichApp, sig = SIGTERM, quiet; |
42 | const char *name; | 42 | const char *name; |
43 | int errors = 0; | ||
43 | 44 | ||
44 | #ifdef CONFIG_KILLALL | 45 | #ifdef CONFIG_KILLALL |
45 | /* Figure out what we are trying to do here */ | 46 | /* Figure out what we are trying to do here */ |
@@ -111,37 +112,33 @@ do_it_now: | |||
111 | perror_msg_and_die( "Bad PID"); | 112 | perror_msg_and_die( "Bad PID"); |
112 | pid = strtol(*argv, NULL, 0); | 113 | pid = strtol(*argv, NULL, 0); |
113 | if (kill(pid, sig) != 0) { | 114 | if (kill(pid, sig) != 0) { |
114 | perror_msg_and_die( "Could not kill pid '%d'", pid); | 115 | perror_msg( "Could not kill pid '%d'", pid); |
116 | errors++; | ||
115 | } | 117 | } |
116 | argv++; | 118 | argv++; |
117 | } | 119 | } |
120 | |||
118 | } | 121 | } |
119 | #ifdef CONFIG_KILLALL | 122 | #ifdef CONFIG_KILLALL |
120 | else { | 123 | else { |
121 | int all_found = TRUE; | ||
122 | pid_t myPid=getpid(); | 124 | pid_t myPid=getpid(); |
123 | /* Looks like they want to do a killall. Do that */ | 125 | /* Looks like they want to do a killall. Do that */ |
124 | while (--argc >= 0) { | 126 | while (--argc >= 0) { |
125 | long* pidList; | 127 | long* pidList; |
126 | 128 | ||
127 | pidList = find_pid_by_name( *argv); | 129 | pidList = find_pid_by_name(*argv); |
128 | if (!pidList || *pidList<=0) { | 130 | if (!pidList || *pidList<=0) { |
129 | all_found = FALSE; | 131 | errors++; |
130 | if (quiet) { | 132 | if (quiet==0) |
131 | exit(EXIT_FAILURE); | 133 | error_msg( "%s: no process killed", *argv); |
132 | } else { | 134 | } else { |
133 | error_msg_and_die( "%s: no process killed", *argv); | 135 | for(; *pidList!=0; pidList++) { |
134 | } | ||
135 | } | ||
136 | |||
137 | for(; pidList && *pidList!=0; pidList++) { | ||
138 | if (*pidList==myPid) | 136 | if (*pidList==myPid) |
139 | continue; | 137 | continue; |
140 | if (kill(*pidList, sig) != 0) { | 138 | if (kill(*pidList, sig) != 0) { |
141 | if (quiet) { | 139 | errors++; |
142 | exit(EXIT_FAILURE); | 140 | if (quiet==0) |
143 | } else { | 141 | perror_msg( "Could not kill pid '%d'", *pidList); |
144 | perror_msg_and_die( "Could not kill pid '%d'", *pidList); | ||
145 | } | 142 | } |
146 | } | 143 | } |
147 | } | 144 | } |
@@ -150,10 +147,7 @@ do_it_now: | |||
150 | * upon exit, so we can save a byte or two */ | 147 | * upon exit, so we can save a byte or two */ |
151 | argv++; | 148 | argv++; |
152 | } | 149 | } |
153 | if (! all_found) | ||
154 | return EXIT_FAILURE; | ||
155 | } | 150 | } |
156 | #endif | 151 | #endif |
157 | 152 | return errors; | |
158 | return EXIT_SUCCESS; | ||
159 | } | 153 | } |