mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
Check write(2) return value to avoid warnings, because in this context failing write is not critical.
This commit is contained in:
parent
a3fb7fd4f6
commit
0b913c650d
15
src/redis.c
15
src/redis.c
@ -318,14 +318,15 @@ void redisLogFromHandler(int level, const char *msg) {
|
|||||||
STDOUT_FILENO;
|
STDOUT_FILENO;
|
||||||
if (fd == -1) return;
|
if (fd == -1) return;
|
||||||
ll2string(buf,sizeof(buf),getpid());
|
ll2string(buf,sizeof(buf),getpid());
|
||||||
write(fd,"[",1);
|
if (write(fd,"[",1) == -1) goto err;
|
||||||
write(fd,buf,strlen(buf));
|
if (write(fd,buf,strlen(buf)) == -1) goto err;
|
||||||
write(fd," | signal handler] (",20);
|
if (write(fd," | signal handler] (",20) == -1) goto err;
|
||||||
ll2string(buf,sizeof(buf),time(NULL));
|
ll2string(buf,sizeof(buf),time(NULL));
|
||||||
write(fd,buf,strlen(buf));
|
if (write(fd,buf,strlen(buf)) == -1) goto err;
|
||||||
write(fd,") ",2);
|
if (write(fd,") ",2) == -1) goto err;
|
||||||
write(fd,msg,strlen(msg));
|
if (write(fd,msg,strlen(msg)) == -1) goto err;
|
||||||
write(fd,"\n",1);
|
if (write(fd,"\n",1) == -1) goto err;
|
||||||
|
err:
|
||||||
if (server.logfile) close(fd);
|
if (server.logfile) close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user