summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-05-30 21:41:06 +0000
committerjilles <jilles@FreeBSD.org>2011-05-30 21:41:06 +0000
commitbe8b81f61633d373f99bbecbab494977e040f0c3 (patch)
treed64d4699dad979af0803a66bfd2656806f9c0a56
parent513df48913e0ff6e63655a5b6c22e8cf5c55ab19 (diff)
downloadFreeBSD-src-be8b81f61633d373f99bbecbab494977e040f0c3.zip
FreeBSD-src-be8b81f61633d373f99bbecbab494977e040f0c3.tar.gz
posix_spawn(): Do not fail when trying to close an fd that is not open.
As noted in Austin Group issue #370 (an interpretation has been issued), failing posix_spawn() because an fd specified with posix_spawn_file_actions_addclose() is not open is unnecessarily harsh, and there are existing implementations that do not fail posix_spawn() for this reason. Reviewed by: ed MFC after: 10 days
-rw-r--r--lib/libc/gen/posix_spawn.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c
index 20f2c16..58044b3 100644
--- a/lib/libc/gen/posix_spawn.c
+++ b/lib/libc/gen/posix_spawn.c
@@ -163,11 +163,8 @@ process_file_actions_entry(posix_spawn_file_actions_entry_t *fae)
return (errno);
break;
case FAE_CLOSE:
- /* Perform a close() */
- if (_close(fae->fae_fildes) != 0) {
- if (errno == EBADF)
- return (EBADF);
- }
+ /* Perform a close(), do not fail if already closed */
+ (void)_close(fae->fae_fildes);
break;
}
return (0);
OpenPOWER on IntegriCloud