X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fprocess%2Fposix_spawn_file_actions_addopen.c;h=82bbcec9eb42cd5f112d2a6b66d0769b8349f11f;hb=6f3ead0ae16deb9f0004b275e29a276c9712ee3c;hp=368922c76b5259944059bad15d1c1d9d8e79fce5;hpb=400c5e5c8307a2ebe44ef1f203f5a15669f20347;p=musl diff --git a/src/process/posix_spawn_file_actions_addopen.c b/src/process/posix_spawn_file_actions_addopen.c index 368922c7..82bbcec9 100644 --- a/src/process/posix_spawn_file_actions_addopen.c +++ b/src/process/posix_spawn_file_actions_addopen.c @@ -6,6 +6,7 @@ int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *restrict fa, int fd, const char *restrict path, int flags, mode_t mode) { + if (fd < 0) return EBADF; struct fdop *op = malloc(sizeof *op + strlen(path) + 1); if (!op) return ENOMEM; op->cmd = FDOP_OPEN;