Skip to content

Commit 1734fb2

Browse files
committed
treat posix_spawn return value as errno
1 parent 3800d86 commit 1734fb2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

exec/spawn.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@
99
#include <spawn.h>
1010
#include <sys/types.h>
1111
#include <sys/wait.h>
12+
#include <err.h>
1213

1314
static void
1415
spawnit(char *progname)
1516
{
16-
int err, status;
17+
int error, status;
1718
pid_t pid;
1819
char *argv[3] = { "ps", "-j", NULL };
1920

20-
if ((err = posix_spawn(&pid, progname, NULL, NULL, argv,
21+
if ((error = posix_spawn(&pid, progname, NULL, NULL, argv,
2122
NULL)) != 0) {
22-
fprintf(stderr, "posix_spawn for %s: %d\n", progname, err);
23+
warn("posix_spawn for %s", progname);
2324
return;
2425
}
2526

0 commit comments

Comments
 (0)