Commit 4178a802 authored by Damian Janowski's avatar Damian Janowski
Browse files

Abort when opening the RDB file results in an error other than ENOENT.

This fixes cases where the RDB file does exist but can't be accessed for
any reason. For instance, when the Redis process doesn't have enough
permissions on the file.
parent 91d3b487
...@@ -1069,7 +1069,6 @@ int rdbLoad(char *filename) { ...@@ -1069,7 +1069,6 @@ int rdbLoad(char *filename) {
fp = fopen(filename,"r"); fp = fopen(filename,"r");
if (!fp) { if (!fp) {
errno = ENOENT;
return REDIS_ERR; return REDIS_ERR;
} }
rioInitWithFile(&rdb,fp); rioInitWithFile(&rdb,fp);
......
...@@ -2736,7 +2736,7 @@ void loadDataFromDisk(void) { ...@@ -2736,7 +2736,7 @@ void loadDataFromDisk(void) {
redisLog(REDIS_NOTICE,"DB loaded from disk: %.3f seconds", redisLog(REDIS_NOTICE,"DB loaded from disk: %.3f seconds",
(float)(ustime()-start)/1000000); (float)(ustime()-start)/1000000);
} else if (errno != ENOENT) { } else if (errno != ENOENT) {
redisLog(REDIS_WARNING,"Fatal error loading the DB. Exiting."); redisLog(REDIS_WARNING,"Fatal error loading the DB: %s. Exiting.",strerror(errno));
exit(1); exit(1);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment