This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: silence warning in libiberty/pex-unix.c
- From: Ben Elliston <bje at au1 dot ibm dot com>
- To: binutils at sourceware dot org, gcc-patches at gcc dot gnu dot org
- Cc: iant at google dot com
- Date: Fri, 12 Jan 2007 11:45:37 +1100
- Subject: 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);