Fix compile warning about unused result for write() function.

This commit is contained in:
Jan Vidar Krey 2011-12-19 00:40:02 +01:00
parent 93caa9b3c1
commit 583900cec5
1 changed files with 9 additions and 4 deletions

View File

@ -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
{