Fix compile warning about unused result for write() function.
This commit is contained in:
parent
93caa9b3c1
commit
583900cec5
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue