diff options
Diffstat (limited to 'procps')
-rw-r--r-- | procps/kill.c | 11 | ||||
-rw-r--r-- | procps/sysctl.c | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/procps/kill.c b/procps/kill.c index 8aa0eb3e2..0b170fa3d 100644 --- a/procps/kill.c +++ b/procps/kill.c | |||
@@ -167,13 +167,15 @@ int kill_main(int argc, char **argv) | |||
167 | /* Stop all processes */ | 167 | /* Stop all processes */ |
168 | kill(-1, SIGSTOP); | 168 | kill(-1, SIGSTOP); |
169 | /* Signal all processes except those in our session */ | 169 | /* Signal all processes except those in our session */ |
170 | while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID))) { | 170 | while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID)) != NULL) { |
171 | int i; | 171 | int i; |
172 | 172 | ||
173 | if (p->sid == (unsigned)sid | 173 | if (p->sid == (unsigned)sid |
174 | || p->pid == (unsigned)pid | 174 | || p->pid == (unsigned)pid |
175 | || p->pid == 1) | 175 | || p->pid == 1 |
176 | ) { | ||
176 | continue; | 177 | continue; |
178 | } | ||
177 | 179 | ||
178 | /* All remaining args must be -o PID options. | 180 | /* All remaining args must be -o PID options. |
179 | * Check p->pid against them. */ | 181 | * Check p->pid against them. */ |
@@ -257,9 +259,10 @@ int kill_main(int argc, char **argv) | |||
257 | pid = bb_strtoi(arg, &end, 10); | 259 | pid = bb_strtoi(arg, &end, 10); |
258 | if (errno && (errno != EINVAL || *end != ' ')) { | 260 | if (errno && (errno != EINVAL || *end != ' ')) { |
259 | bb_error_msg("invalid number '%s'", arg); | 261 | bb_error_msg("invalid number '%s'", arg); |
260 | *end = '\0'; | ||
261 | errors++; | 262 | errors++; |
262 | } else if (kill(pid, signo) != 0) { | 263 | break; |
264 | } | ||
265 | if (kill(pid, signo) != 0) { | ||
263 | bb_perror_msg("can't kill pid %d", (int)pid); | 266 | bb_perror_msg("can't kill pid %d", (int)pid); |
264 | errors++; | 267 | errors++; |
265 | } | 268 | } |
diff --git a/procps/sysctl.c b/procps/sysctl.c index cb3b6a25a..5296d0f58 100644 --- a/procps/sysctl.c +++ b/procps/sysctl.c | |||
@@ -224,7 +224,7 @@ static int sysctl_handle_preload_file(const char *filename) | |||
224 | parser = config_open(filename); | 224 | parser = config_open(filename); |
225 | /* Must do it _after_ config_open(): */ | 225 | /* Must do it _after_ config_open(): */ |
226 | xchdir("/proc/sys"); | 226 | xchdir("/proc/sys"); |
227 | /* xchroot(".") - if you are paranoid */ | 227 | /* xchroot("/proc/sys") - if you are paranoid */ |
228 | 228 | ||
229 | //TODO: ';' is comment char too | 229 | //TODO: ';' is comment char too |
230 | //TODO: comment may be only at line start. "var=1 #abc" - "1 #abc" is the value | 230 | //TODO: comment may be only at line start. "var=1 #abc" - "1 #abc" is the value |
@@ -260,7 +260,7 @@ int sysctl_main(int argc UNUSED_PARAM, char **argv) | |||
260 | return sysctl_handle_preload_file(*argv ? *argv : "/etc/sysctl.conf"); | 260 | return sysctl_handle_preload_file(*argv ? *argv : "/etc/sysctl.conf"); |
261 | } | 261 | } |
262 | xchdir("/proc/sys"); | 262 | xchdir("/proc/sys"); |
263 | /* xchroot(".") - if you are paranoid */ | 263 | /* xchroot("/proc/sys") - if you are paranoid */ |
264 | if (opt & (FLAG_TABLE_FORMAT | FLAG_SHOW_ALL)) { | 264 | if (opt & (FLAG_TABLE_FORMAT | FLAG_SHOW_ALL)) { |
265 | return sysctl_act_recursive("."); | 265 | return sysctl_act_recursive("."); |
266 | } | 266 | } |