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.17-155-gab087e0


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  ab087e0aa4bd9f12a73ca0b248f02d8a22d49e46 (commit)
      from  ba6f5ae50b86b58b8735671db2c4798249e42ddf (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=ab087e0aa4bd9f12a73ca0b248f02d8a22d49e46

commit ab087e0aa4bd9f12a73ca0b248f02d8a22d49e46
Author: Andreas Schwab <schwab@suse.de>
Date:   Sat Jan 19 17:18:47 2013 +0100

    Avoid busy loop in wordexp when substituted command closed its stdout

diff --git a/ChangeLog b/ChangeLog
index 3bf3949..9b53463 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-21  Andreas Schwab  <schwab@suse.de>
+
+	[BZ #15020]
+	* posix/wordexp.c (exec_comm): Avoid busy loop when command has
+	closed its stdout.
+
 2013-01-20  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* sysdeps/powerpc/powerpc32/power4/fpu/mpa.c: Don't include
diff --git a/NEWS b/NEWS
index cf6191b..abbbbae 100644
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,7 @@ Version 2.18
 * The following bugs are resolved with this release:
 
   13951, 14200, 14317, 14327, 14496, 14964, 14981, 14982, 14985, 14994,
-  14996, 15003, 15023.
+  14996, 15003, 15020, 15023.
 
 
 Version 2.17
diff --git a/posix/wordexp.c b/posix/wordexp.c
index bf49baa..96ce8a4 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -953,7 +953,12 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
 	  if ((buflen = TEMP_FAILURE_RETRY (__read (fildes[0], buffer,
 						    bufsize))) < 1)
 	    {
-	      if (TEMP_FAILURE_RETRY (__waitpid (pid, &status, WNOHANG)) == 0)
+	      /* If read returned 0 then the process has closed its
+		 stdout.  Don't use WNOHANG in that case to avoid busy
+		 looping until the process eventually exits.  */
+	      if (TEMP_FAILURE_RETRY (__waitpid (pid, &status,
+						 buflen == 0 ? 0 : WNOHANG))
+		  == 0)
 		continue;
 	      if ((buflen = TEMP_FAILURE_RETRY (__read (fildes[0], buffer,
 							bufsize))) < 1)
@@ -983,7 +988,12 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
 	  if ((buflen = TEMP_FAILURE_RETRY (__read (fildes[0], buffer,
 						    bufsize))) < 1)
 	    {
-	      if (TEMP_FAILURE_RETRY (__waitpid (pid, &status, WNOHANG)) == 0)
+	      /* If read returned 0 then the process has closed its
+		 stdout.  Don't use WNOHANG in that case to avoid busy
+		 looping until the process eventually exits.  */
+	      if (TEMP_FAILURE_RETRY (__waitpid (pid, &status,
+						 buflen == 0 ? 0 : WNOHANG))
+		  == 0)
 		continue;
 	      if ((buflen = TEMP_FAILURE_RETRY (__read (fildes[0], buffer,
 							bufsize))) < 1)

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

Summary of changes:
 ChangeLog       |    6 ++++++
 NEWS            |    2 +-
 posix/wordexp.c |   14 ++++++++++++--
 3 files changed, 19 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]