mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-05 12:18:09 +02:00
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>
This commit is contained in:
parent
7abd286850
commit
0af8788579
1 changed files with 8 additions and 2 deletions
10
os/log.c
10
os/log.c
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue