diff options
author | Keith Packard <keithp@keithp.com> | 2014-04-18 15:09:50 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-04-18 16:30:17 -0700 |
commit | 0af8788579c2f52cc1172952c9004483bf863932 (patch) | |
tree | 1fe7b4d0ebeac659ca4ce8d5016891512843fe18 /os | |
parent | 7abd28685066369ded807f59493c1159cfb286bf (diff) |
os: Ignore log file write failures
There's no place to log the message if writing to the log file fails,
and we surely don't want to crash in that case, so just ignore errors
and keep going.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Diffstat (limited to 'os')
-rw-r--r-- | os/log.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -491,13 +491,14 @@ static void LogSWrite(int verb, const char *buf, size_t len, Bool end_line) { static Bool newline = TRUE; + int ret; if (verb < 0 || logVerbosity >= verb) - write(2, buf, len); + ret = write(2, buf, len); if (verb < 0 || logFileVerbosity >= verb) { if (inSignalContext && logFileFd >= 0) { - write(logFileFd, buf, len); + ret = write(logFileFd, buf, len); #ifndef WIN32 if (logFlush && logSync) fsync(logFileFd); @@ -529,6 +530,11 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line) bufferPos += len; } } + + /* There's no place to log an error message if the log write + * fails... + */ + (void) ret; } void |