stop using non-standard macro, use WEXITSTATUS instead

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2009-06-07 16:02:00 +02:00
parent d6b05eb9c2
commit 8f24f9812d
5 changed files with 7 additions and 11 deletions

View File

@ -765,12 +765,8 @@ pid_t safe_waitpid(pid_t pid, int *wstat, int options) FAST_FUNC;
*/ */
int wait4pid(pid_t pid) FAST_FUNC; int wait4pid(pid_t pid) FAST_FUNC;
pid_t wait_any_nohang(int *wstat) FAST_FUNC; pid_t wait_any_nohang(int *wstat) FAST_FUNC;
#define wait_crashed(w) ((w) & 127)
#define wait_exitcode(w) ((w) >> 8)
#define wait_stopsig(w) ((w) >> 8)
#define wait_stopped(w) (((w) & 127) == 127)
/* wait4pid(spawn(argv)) + NOFORK/NOEXEC (if configured) */ /* wait4pid(spawn(argv)) + NOFORK/NOEXEC (if configured) */
pid_t spawn_and_wait(char **argv) FAST_FUNC; int spawn_and_wait(char **argv) FAST_FUNC;
struct nofork_save_area { struct nofork_save_area {
jmp_buf die_jmp; jmp_buf die_jmp;
const char *applet_name; const char *applet_name;

View File

@ -256,8 +256,7 @@ pid_t FAST_FUNC fork_or_rexec(char **argv)
pid_t pid; pid_t pid;
/* Maybe we are already re-execed and come here again? */ /* Maybe we are already re-execed and come here again? */
if (re_execed) if (re_execed)
return 0; /* child */ return 0;
pid = vfork(); pid = vfork();
if (pid < 0) /* wtf? */ if (pid < 0) /* wtf? */
bb_perror_msg_and_die("vfork"); bb_perror_msg_and_die("vfork");

View File

@ -252,7 +252,8 @@ static unsigned custom(struct svdir *s, char c)
char a[10]; char a[10];
struct stat st; struct stat st;
if (s->islog) return 0; if (s->islog)
return 0;
strcpy(a, "control/?"); strcpy(a, "control/?");
a[8] = c; /* replace '?' */ a[8] = c; /* replace '?' */
if (stat(a, &st) == 0) { if (stat(a, &st) == 0) {
@ -274,7 +275,7 @@ static unsigned custom(struct svdir *s, char c)
warn_cannot("wait for child control/?"); warn_cannot("wait for child control/?");
return 0; return 0;
} }
return !wait_exitcode(w); return WEXITSTATUS(w) == 0;
} }
} else { } else {
if (errno != ENOENT) if (errno != ENOENT)

View File

@ -337,7 +337,7 @@ static int checkscript(void)
bb_perror_msg(WARN"cannot %s child %s/check", "wait for", *service); bb_perror_msg(WARN"cannot %s child %s/check", "wait for", *service);
return 0; return 0;
} }
return !wait_exitcode(w); return WEXITSTATUS(w) == 0;
} }
static int check(const char *a) static int check(const char *a)

View File

@ -281,7 +281,7 @@ static unsigned processorstop(struct logdir *ld)
if (ld->fddir == -1) return 1; if (ld->fddir == -1) return 1;
while (fchdir(ld->fddir) == -1) while (fchdir(ld->fddir) == -1)
pause2cannot("change directory, want processor", ld->name); pause2cannot("change directory, want processor", ld->name);
if (wait_exitcode(wstat) != 0) { if (WEXITSTATUS(wstat) != 0) {
warnx("processor failed, restart", ld->name); warnx("processor failed, restart", ld->name);
ld->fnsave[26] = 't'; ld->fnsave[26] = 't';
unlink(ld->fnsave); unlink(ld->fnsave);