[Libreoffice-commits] .: dmake/unix

Michael Meeks michael at kemper.freedesktop.org
Fri Jul 22 03:00:45 PDT 2011


 dmake/unix/runargv.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 735a19e5aada97a6aaebda9e295018846cfa1563
Author: Michael Meeks <michael.meeks at novell.com>
Date:   Fri Jul 22 10:58:00 2011 +0100

    don't let our fprintf on a broken pipe pollute errno's ECHILD with EPIPE

diff --git a/dmake/unix/runargv.c b/dmake/unix/runargv.c
index 4d18eff..8135e67 100644
--- a/dmake/unix/runargv.c
+++ b/dmake/unix/runargv.c
@@ -269,9 +269,10 @@ dmwaitnext( wid, status )
 
    /* If ECHILD is set from waitpid/wait then no child was left. */
    if( *wid  == -1 ) {
-      fprintf(stderr, "%s:  Internal Error: wait() failed: %d -  %s\n",
-          Pname, errno, strerror(errno) );
-      if(errno != ECHILD) {
+	 int realErr = errno; // fprintf can pollute errno
+	 fprintf(stderr, "%s:  Internal Error: wait() failed: %d -  %s\n",
+			 Pname, errno, strerror(errno) );
+      if( realErr != ECHILD ) {
      /* Wait was interrupted or a child was terminated (SIGCHLD) */
      return -2;
       } else {
@@ -369,9 +370,10 @@ dmwaitpid( pqid, wid, status )
    }
    /* If ECHILD is set from waitpid/wait then no child was left. */
    if( *wid  == -1 ) {
+	 int realErr = errno; // fprintf can pollute errno
       fprintf(stderr, "%s:  Internal Error: waitpid() failed: %d -  %s\n",
           Pname, errno, strerror(errno) );
-      if(errno != ECHILD) {
+      if(realErr != ECHILD) {
      /* Wait was interrupted or a child was terminated (SIGCHLD) */
      return -2;
       } else {


More information about the Libreoffice-commits mailing list