stop using non-standard macro, use WEXITSTATUS instead
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/include/libbb.h b/include/libbb.h
index 963e2af..62a60f9 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -765,12 +765,8 @@
*/
int wait4pid(pid_t pid) 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) */
-pid_t spawn_and_wait(char **argv) FAST_FUNC;
+int spawn_and_wait(char **argv) FAST_FUNC;
struct nofork_save_area {
jmp_buf die_jmp;
const char *applet_name;
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index f64239a..72edfc7 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -256,8 +256,7 @@
pid_t pid;
/* Maybe we are already re-execed and come here again? */
if (re_execed)
- return 0; /* child */
-
+ return 0;
pid = vfork();
if (pid < 0) /* wtf? */
bb_perror_msg_and_die("vfork");
diff --git a/runit/runsv.c b/runit/runsv.c
index 6d34dc1..5cb5d2f 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -252,7 +252,8 @@
char a[10];
struct stat st;
- if (s->islog) return 0;
+ if (s->islog)
+ return 0;
strcpy(a, "control/?");
a[8] = c; /* replace '?' */
if (stat(a, &st) == 0) {
@@ -274,7 +275,7 @@
warn_cannot("wait for child control/?");
return 0;
}
- return !wait_exitcode(w);
+ return WEXITSTATUS(w) == 0;
}
} else {
if (errno != ENOENT)
diff --git a/runit/sv.c b/runit/sv.c
index 20e8619..e3b9a4e 100644
--- a/runit/sv.c
+++ b/runit/sv.c
@@ -337,7 +337,7 @@
bb_perror_msg(WARN"cannot %s child %s/check", "wait for", *service);
return 0;
}
- return !wait_exitcode(w);
+ return WEXITSTATUS(w) == 0;
}
static int check(const char *a)
diff --git a/runit/svlogd.c b/runit/svlogd.c
index 9609fa3..25799f6 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -281,7 +281,7 @@
if (ld->fddir == -1) return 1;
while (fchdir(ld->fddir) == -1)
pause2cannot("change directory, want processor", ld->name);
- if (wait_exitcode(wstat) != 0) {
+ if (WEXITSTATUS(wstat) != 0) {
warnx("processor failed, restart", ld->name);
ld->fnsave[26] = 't';
unlink(ld->fnsave);