Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 May 2011 21:41:06 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222511 - head/lib/libc/gen
Message-ID:  <201105302141.p4ULf6HB094332@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Mon May 30 21:41:06 2011
New Revision: 222511
URL: http://svn.freebsd.org/changeset/base/222511

Log:
  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

Modified:
  head/lib/libc/gen/posix_spawn.c

Modified: head/lib/libc/gen/posix_spawn.c
==============================================================================
--- head/lib/libc/gen/posix_spawn.c	Mon May 30 21:34:44 2011	(r222510)
+++ head/lib/libc/gen/posix_spawn.c	Mon May 30 21:41:06 2011	(r222511)
@@ -163,11 +163,8 @@ process_file_actions_entry(posix_spawn_f
 			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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105302141.p4ULf6HB094332>