[elinks-dev] [PATCH] osdep.c: fix gcc warning

Alexey Tourbin at at altlinux.ru
Tue Feb 27 03:34:10 MST 2007


osdep.c: In function 'start_thread':
osdep.c:648: warning: ignoring return value of 'write', declared with attribute warn_unused_result
---
 src/osdep/osdep.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/osdep/osdep.c b/src/osdep/osdep.c
index 374b3e5..c5b5408 100644
--- a/src/osdep/osdep.c
+++ b/src/osdep/osdep.c
@@ -631,6 +631,7 @@ start_thread(void (*fn)(void *, int), void *ptr, int l)
 	pid = fork();
 	if (!pid) {
 		struct terminal *term;
+		int rv;
 
 		/* Close input in this thread; otherwise, if it will live
 		 * longer than its parent, it'll block the terminal until it'll
@@ -645,12 +646,12 @@ start_thread(void (*fn)(void *, int), void *ptr, int l)
 
 		close(p[0]);
 		fn(ptr, p[1]);
-		write(p[1], "x", 1);
+		rv = write(p[1], "x", 1);
 		close(p[1]);
 		/* We use _exit() here instead of exit(), see
 		 * http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC6 for
 		 * reasons. Fixed by Sven Neumann <sven at convergence.de>. */
-		_exit(0);
+		_exit(rv == 1 ? 0 : 1);
 	}
 	if (pid == -1) {
 		close(p[0]);
-- 
1.5.0.1.GIT



More information about the elinks-dev mailing list