X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/be4f8cccaa49d45dca61b398e5dd6922c5eeada0..e51f7d2c173bb0a29893e24b56355df806f44bb2:/src/redis.c diff --git a/src/redis.c b/src/redis.c index a403bc92..9c49bc22 100644 --- a/src/redis.c +++ b/src/redis.c @@ -305,7 +305,7 @@ void redisLogFromHandler(int level, const char *msg) { (server.logfile == NULL && server.daemonize)) return; fd = server.logfile ? open(server.logfile, O_APPEND|O_CREAT|O_WRONLY, 0644) : - STDIN_FILENO; + STDOUT_FILENO; if (fd == -1) return; ll2string(buf,sizeof(buf),getpid()); write(fd,"[",1); @@ -316,7 +316,7 @@ void redisLogFromHandler(int level, const char *msg) { write(fd,") ",2); write(fd,msg,strlen(msg)); write(fd,"\n",1); - close(fd); + if (server.logfile) close(fd); } /* Redis generally does not try to recover from out of memory conditions