]> git.saurik.com Git - redis.git/commitdiff
Check for fork() failure in background saving
authorantirez <antirez@gmail.com>
Wed, 29 Apr 2009 08:33:29 +0000 (10:33 +0200)
committerantirez <antirez@gmail.com>
Wed, 29 Apr 2009 08:33:29 +0000 (10:33 +0200)
redis.c

diff --git a/redis.c b/redis.c
index 1237a048d25f92221ed7528475756ebe2c8cb39d..c120b9db175a351762fc78d4199ce0aa8c9aba9e 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -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;