From 583900cec50aca90a6ffffb211c9f019a77ea357 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Mon, 19 Dec 2011 00:40:02 +0100 Subject: [PATCH] Fix compile warning about unused result for write() function. --- src/plugins/mod_logging.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/mod_logging.c b/src/plugins/mod_logging.c index 4b3a786..794c854 100644 --- a/src/plugins/mod_logging.c +++ b/src/plugins/mod_logging.c @@ -165,13 +165,18 @@ static void log_message(struct log_data* data, const char *format, ...) size = vsnprintf(logmsg + 20, 1004, format, args); va_end(args); - write(data->fd, logmsg, size + 20); - + if (write(data->fd, logmsg, size + 20) < (size+20)) + { + fprintf(stderr, "Unable to write full log. Error=%d: %s\n", errno, strerror(errno)); + } + else + { #ifdef _POSIX_SYNCHRONIZED_IO - fdatasync(data->fd); + fdatasync(data->fd); #else - fsync(data->fd); + fsync(data->fd); #endif + } } else {