Skip to content

Commit 3d9f244

Browse files
committed
posix: Ensure that errno is set after posix_spawnp fails
In contrast to glibc, Darwin's posix_spawnp implementation doesn't set errno on failure. Fixes #227.
1 parent 7fd2833 commit 3d9f244

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cbits/posix/posix_spawn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ do_spawn_posix (char *const args[],
201201

202202
r = posix_spawnp(&pid, args[0], &fa, &sa, args, environment ? environment : environ);
203203
if (r != 0) {
204+
errno = r; // posix_spawn doesn't necessarily set errno; see #227.
204205
*failed_doing = "posix_spawnp";
205206
goto fail;
206207
} else {

0 commit comments

Comments
 (0)