diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-07 16:02:00 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-07 16:02:00 +0200 |
commit | 8f24f9812df8dec34a991b2c572092639586f154 (patch) | |
tree | fcfc01da5aa08243cd1f0ea3bc2f95a8d3206ada | |
parent | d6b05eb9c27196ebe89b180d71ad86bf42e97002 (diff) | |
download | busybox-w32-8f24f9812df8dec34a991b2c572092639586f154.tar.gz busybox-w32-8f24f9812df8dec34a991b2c572092639586f154.tar.bz2 busybox-w32-8f24f9812df8dec34a991b2c572092639586f154.zip |
stop using non-standard macro, use WEXITSTATUS instead
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | include/libbb.h | 6 | ||||
-rw-r--r-- | libbb/vfork_daemon_rexec.c | 3 | ||||
-rw-r--r-- | runit/runsv.c | 5 | ||||
-rw-r--r-- | runit/sv.c | 2 | ||||
-rw-r--r-- | runit/svlogd.c | 2 |
5 files changed, 7 insertions, 11 deletions
diff --git a/include/libbb.h b/include/libbb.h index 963e2af28..62a60f9f4 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -765,12 +765,8 @@ pid_t safe_waitpid(pid_t pid, int *wstat, int options) FAST_FUNC; | |||
765 | */ | 765 | */ |
766 | int wait4pid(pid_t pid) FAST_FUNC; | 766 | int wait4pid(pid_t pid) FAST_FUNC; |
767 | pid_t wait_any_nohang(int *wstat) FAST_FUNC; | 767 | pid_t wait_any_nohang(int *wstat) FAST_FUNC; |
768 | #define wait_crashed(w) ((w) & 127) | ||
769 | #define wait_exitcode(w) ((w) >> 8) | ||
770 | #define wait_stopsig(w) ((w) >> 8) | ||
771 | #define wait_stopped(w) (((w) & 127) == 127) | ||
772 | /* wait4pid(spawn(argv)) + NOFORK/NOEXEC (if configured) */ | 768 | /* wait4pid(spawn(argv)) + NOFORK/NOEXEC (if configured) */ |
773 | pid_t spawn_and_wait(char **argv) FAST_FUNC; | 769 | int spawn_and_wait(char **argv) FAST_FUNC; |
774 | struct nofork_save_area { | 770 | struct nofork_save_area { |
775 | jmp_buf die_jmp; | 771 | jmp_buf die_jmp; |
776 | const char *applet_name; | 772 | const char *applet_name; |
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index f64239a96..72edfc70d 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c | |||
@@ -256,8 +256,7 @@ pid_t FAST_FUNC fork_or_rexec(char **argv) | |||
256 | pid_t pid; | 256 | pid_t pid; |
257 | /* Maybe we are already re-execed and come here again? */ | 257 | /* Maybe we are already re-execed and come here again? */ |
258 | if (re_execed) | 258 | if (re_execed) |
259 | return 0; /* child */ | 259 | return 0; |
260 | |||
261 | pid = vfork(); | 260 | pid = vfork(); |
262 | if (pid < 0) /* wtf? */ | 261 | if (pid < 0) /* wtf? */ |
263 | bb_perror_msg_and_die("vfork"); | 262 | bb_perror_msg_and_die("vfork"); |
diff --git a/runit/runsv.c b/runit/runsv.c index 6d34dc133..5cb5d2f13 100644 --- a/runit/runsv.c +++ b/runit/runsv.c | |||
@@ -252,7 +252,8 @@ static unsigned custom(struct svdir *s, char c) | |||
252 | char a[10]; | 252 | char a[10]; |
253 | struct stat st; | 253 | struct stat st; |
254 | 254 | ||
255 | if (s->islog) return 0; | 255 | if (s->islog) |
256 | return 0; | ||
256 | strcpy(a, "control/?"); | 257 | strcpy(a, "control/?"); |
257 | a[8] = c; /* replace '?' */ | 258 | a[8] = c; /* replace '?' */ |
258 | if (stat(a, &st) == 0) { | 259 | if (stat(a, &st) == 0) { |
@@ -274,7 +275,7 @@ static unsigned custom(struct svdir *s, char c) | |||
274 | warn_cannot("wait for child control/?"); | 275 | warn_cannot("wait for child control/?"); |
275 | return 0; | 276 | return 0; |
276 | } | 277 | } |
277 | return !wait_exitcode(w); | 278 | return WEXITSTATUS(w) == 0; |
278 | } | 279 | } |
279 | } else { | 280 | } else { |
280 | if (errno != ENOENT) | 281 | if (errno != ENOENT) |
diff --git a/runit/sv.c b/runit/sv.c index 20e86199a..e3b9a4e31 100644 --- a/runit/sv.c +++ b/runit/sv.c | |||
@@ -337,7 +337,7 @@ static int checkscript(void) | |||
337 | bb_perror_msg(WARN"cannot %s child %s/check", "wait for", *service); | 337 | bb_perror_msg(WARN"cannot %s child %s/check", "wait for", *service); |
338 | return 0; | 338 | return 0; |
339 | } | 339 | } |
340 | return !wait_exitcode(w); | 340 | return WEXITSTATUS(w) == 0; |
341 | } | 341 | } |
342 | 342 | ||
343 | static int check(const char *a) | 343 | static int check(const char *a) |
diff --git a/runit/svlogd.c b/runit/svlogd.c index 9609fa37c..25799f6be 100644 --- a/runit/svlogd.c +++ b/runit/svlogd.c | |||
@@ -281,7 +281,7 @@ static unsigned processorstop(struct logdir *ld) | |||
281 | if (ld->fddir == -1) return 1; | 281 | if (ld->fddir == -1) return 1; |
282 | while (fchdir(ld->fddir) == -1) | 282 | while (fchdir(ld->fddir) == -1) |
283 | pause2cannot("change directory, want processor", ld->name); | 283 | pause2cannot("change directory, want processor", ld->name); |
284 | if (wait_exitcode(wstat) != 0) { | 284 | if (WEXITSTATUS(wstat) != 0) { |
285 | warnx("processor failed, restart", ld->name); | 285 | warnx("processor failed, restart", ld->name); |
286 | ld->fnsave[26] = 't'; | 286 | ld->fnsave[26] = 't'; |
287 | unlink(ld->fnsave); | 287 | unlink(ld->fnsave); |