This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

PATCH: silence warning in libiberty/pex-unix.c


The last patch to to libiberty to fix an ignored function result.  This
seems like a reasonable way to handle write failing: call _exit
prematurely, just as the function does at completion anyway.  Okay for
the trunk?

2007-01-12  Ben Elliston  <bje@au.ibm.com>

        * pex-unix.c (writeerr): If any write returns -1, just call _exit.

Index: pex-unix.c
===================================================================
RCS file: /cvs/src/src/libiberty/pex-unix.c,v
retrieving revision 1.11
diff -u -p -r1.11 pex-unix.c
--- pex-unix.c  28 Aug 2006 00:56:12 -0000      1.11
+++ pex-unix.c  12 Jan 2007 00:43:04 -0000
@@ -339,7 +339,7 @@ static void
 pex_child_error (struct pex_obj *obj, const char *executable,
                 const char *errmsg, int err)
 {
-#define writeerr(s) write (STDERR_FILE_NO, s, strlen (s))
+#define writeerr(s) if (write (STDERR_FILE_NO, s, 0) < 0) _exit (-1)
   writeerr (obj->pname);
   writeerr (": error trying to exec '");
   writeerr (executable);



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