Check for fork() failure in background saving

This commit is contained in:
antirez 2009-04-29 10:33:29 +02:00
parent 3a2694c441
commit 5a7c647e9a
1 changed files with 5 additions and 0 deletions

View File

@ -1879,6 +1879,11 @@ static int rdbSaveBackground(char *filename) {
}
} else {
/* Parent */
if (childpid == -1) {
redisLog(REDIS_WARNING,"Can't save in background: fork: %s",
strerror(errno));
return REDIS_ERR;
}
redisLog(REDIS_NOTICE,"Background saving started by pid %d",childpid);
server.bgsaveinprogress = 1;
return REDIS_OK;