This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.12-254-gcfa28e5


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  cfa28e560ef69372b9e15e9a2d924a0fbcfc7bca (commit)
      from  1086d70d916fd0eb969b3d89ff88abd35f6a5c34 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=cfa28e560ef69372b9e15e9a2d924a0fbcfc7bca

commit cfa28e560ef69372b9e15e9a2d924a0fbcfc7bca
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Thu Jan 13 13:27:46 2011 -0500

    Relax requirement on close in child created by posix_spawn.

diff --git a/ChangeLog b/ChangeLog
index 3035d3d..f477fed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-01-13  Ulrich Drepper  <drepper@gmail.com>
 
+	* sysdeps/posix/spawni.c (__spawni): Don't fail if close file action
+	in child fails because the descriptor is already closed.
+
 	[BZ #12397]
 	* sysdeps/unix/sysv/linux/mkdirat.c (mkdirat): Fix handling of missing
 	syscall.
diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c
index 29803a8..c5a827d 100644
--- a/sysdeps/posix/spawni.c
+++ b/sysdeps/posix/spawni.c
@@ -1,5 +1,5 @@
 /* Guts of POSIX spawn interface.  Generic POSIX.1 version.
-   Copyright (C) 2000-2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2000-2005, 2006, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <sys/resource.h>
 #include "spawn_int.h"
 #include <not-cancel.h>
 #include <local-setxid.h>
@@ -164,6 +165,8 @@ __spawni (pid_t *pid, const char *file,
   if (file_actions != NULL)
     {
       int cnt;
+      struct rlimit64 fdlimit;
+      bool have_fdlimit = false;
 
       for (cnt = 0; cnt < file_actions->__used; ++cnt)
 	{
@@ -173,8 +176,19 @@ __spawni (pid_t *pid, const char *file,
 	    {
 	    case spawn_do_close:
 	      if (close_not_cancel (action->action.close_action.fd) != 0)
-		/* Signal the error.  */
-		_exit (SPAWN_ERROR);
+		{
+		  if (! have_fdlimit)
+		    {
+		      getrlimit64 (RLIMIT_NOFILE, &fdlimit);
+		      have_fdlimit = true;
+		    }
+
+		  /* Only signal errors for file descriptors out of range.  */
+		  if (action->action.close_action.fd < 0
+		      || action->action.close_action.fd >= fdlimit.rlim_cur)
+		    /* Signal the error.  */
+		    _exit (SPAWN_ERROR);
+		}
 	      break;
 
 	    case spawn_do_open:

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog              |    3 +++
 sysdeps/posix/spawni.c |   20 +++++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]