[PATCH] osdep.c: fix gcc warning

Alexey Tourbin <[email protected]>
Newsgroups gmane.comp.web.links
Message-ID <[email protected]>
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 <[email protected]>. */
-		_exit(0);
+		_exit(rv == 1 ? 0 : 1);
 	}
 	if (pid == -1) {
 		close(p[0]);
-- 
1.5.0.1.GIT
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.