From 33bd8fb9810249a35d3bd9f5ddcb8a4f85a1c725 Mon Sep 17 00:00:00 2001 From: YaacovHazan <31382944+YaacovHazan@users.noreply.github.com> Date: Mon, 25 Jul 2022 10:09:58 +0300 Subject: [PATCH] Add error log message when failing to open RDB file for reading (#11036) When failing to open the rdb file, there was no specific error printed (unlike a corrupt file), so it was not clear what failed and why. --- src/rdb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rdb.c b/src/rdb.c index 79c156f18a..3cddccec80 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -3254,7 +3254,11 @@ int rdbLoad(char *filename, rdbSaveInfo *rsi, int rdbflags) { int retval; struct stat sb; - if ((fp = fopen(filename,"r")) == NULL) return C_ERR; + fp = fopen(filename, "r"); + if (fp == NULL) { + serverLog(LL_WARNING,"Fatal error: can't open the RDB file %s for reading: %s", filename, strerror(errno)); + return C_ERR; + } if (fstat(fileno(fp), &sb) == -1) sb.st_size = 0;