make posix_spawn accept null pid pointer arguments
authorRich Felker <dalias@aerifal.cx>
Wed, 12 Feb 2014 06:03:07 +0000 (01:03 -0500)
committerRich Felker <dalias@aerifal.cx>
Wed, 12 Feb 2014 06:03:07 +0000 (01:03 -0500)
this is a requirement in the specification that was overlooked.

src/process/posix_spawn.c

index eb98f9f..f675a13 100644 (file)
@@ -166,7 +166,7 @@ int __posix_spawnx(pid_t *restrict res, const char *restrict path,
 
        close(args.p[0]);
 
-       if (!ec) *res = pid;
+       if (!ec && res) *res = pid;
 
        pthread_sigmask(SIG_SETMASK, &args.oldmask, 0);
        pthread_setcancelstate(cs, 0);