Commit 5120dc38 by Ben Elliston Committed by Ben Elliston

pex-unix.c (pex_child_error): Improve warning avoidance by checking the results…

pex-unix.c (pex_child_error): Improve warning avoidance by checking the results of write(3) and exiting with...

	* pex-unix.c (pex_child_error): Improve warning avoidance by
	checking the results of write(3) and exiting with -2 if any write
	returns a negative value.

Co-Authored-By: Ian Lance Taylor <iant@google.com>

From-SVN: r154431
parent 5154a159
2009-11-23 Ben Elliston <bje@au.ibm.com>
Ian Lance Taylor <iant@google.com>
* pex-unix.c (pex_child_error): Improve warning avoidance by
checking the results of write(3) and exiting with -2 if any write
returns a negative value.
2009-11-22 Steve Ward <planet36@gmail.com>
* dyn-string.c (dyn_string_append_char): Fix typo in comment.
......
......@@ -368,7 +368,8 @@ static void
pex_child_error (struct pex_obj *obj, const char *executable,
const char *errmsg, int err)
{
#define writeerr(s) if (write (STDERR_FILE_NO, s, strlen (s))) {}
int retval = 0;
#define writeerr(s) retval |= (write (STDERR_FILE_NO, s, strlen (s)) < 0)
writeerr (obj->pname);
writeerr (": error trying to exec '");
writeerr (executable);
......@@ -378,7 +379,8 @@ pex_child_error (struct pex_obj *obj, const char *executable,
writeerr (xstrerror (err));
writeerr ("\n");
#undef writeerr
_exit (-1);
/* Exit with -2 if the error output failed, too. */
_exit (retval == 0 ? -1 : -2);
}
/* Execute a child. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment