[Sheepdog] [PATCH] logger: quiet gcc about write()

Liu Yuan namei.unix at gmail.com
Thu Nov 17 10:58:41 CET 2011


From: Liu Yuan <tailai.ly at taobao.com>

use xwrite() instead of write() to get rid of below kindly warning:

logger.c:276: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 lib/logger.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/logger.c b/lib/logger.c
index cd02892..5be035a 100644
--- a/lib/logger.c
+++ b/lib/logger.c
@@ -30,6 +30,7 @@
 #include <sys/prctl.h>
 
 #include "logger.h"
+#include "util.h"
 
 #define LOGDBG 0
 
@@ -273,7 +274,7 @@ static void log_syslog(void * buff)
 	struct logmsg * msg = (struct logmsg *)buff;
 
 	if (la->fd >= 0)
-		write(la->fd, (char *)&msg->str, strlen((char *)&msg->str));
+		xwrite(la->fd, (char *)&msg->str, strlen((char *)&msg->str));
 	else
 		syslog(msg->prio, "%s", (char *)&msg->str);
 }
-- 
1.7.6.1




More information about the sheepdog mailing list