Unverified Commit 9630ded3 authored by Pavel Melkozerov's avatar Pavel Melkozerov Committed by GitHub
Browse files

fix fob bad log messages in rdbSave (#9842) (#9843)



logs message prints wrong file is failed to open temporary file
logs have error occurred in getcwd (uses same errno to report error)
Co-authored-by: default avatarPavel Melkozerov <pavel.melkozerov@nokia.com>
parent 45129059
......@@ -292,6 +292,7 @@ int startAppendOnly(void) {
newfd = open(server.aof_filename,O_WRONLY|O_APPEND|O_CREAT,0644);
serverAssert(server.aof_state == AOF_OFF);
if (newfd == -1) {
char *str_err = strerror(errno);
char *cwdp = getcwd(cwd,MAXPATHLEN);
serverLog(LL_WARNING,
......@@ -299,7 +300,7 @@ int startAppendOnly(void) {
"append only file %s (in server root dir %s): %s",
server.aof_filename,
cwdp ? cwdp : "unknown",
strerror(errno));
str_err);
return C_ERR;
}
if (hasActiveChildProcess() && server.child_type != CHILD_TYPE_AOF) {
......
......@@ -1372,13 +1372,14 @@ int rdbSave(char *filename, rdbSaveInfo *rsi) {
snprintf(tmpfile,256,"temp-%d.rdb", (int) getpid());
fp = fopen(tmpfile,"w");
if (!fp) {
char *str_err = strerror(errno);
char *cwdp = getcwd(cwd,MAXPATHLEN);
serverLog(LL_WARNING,
"Failed opening the RDB file %s (in server root dir %s) "
"Failed opening the temp RDB file %s (in server root dir %s) "
"for saving: %s",
filename,
tmpfile,
cwdp ? cwdp : "unknown",
strerror(errno));
str_err);
return C_ERR;
}
......@@ -1402,6 +1403,7 @@ int rdbSave(char *filename, rdbSaveInfo *rsi) {
/* Use RENAME to make sure the DB file is changed atomically only
* if the generate DB file is ok. */
if (rename(tmpfile,filename) == -1) {
char *str_err = strerror(errno);
char *cwdp = getcwd(cwd,MAXPATHLEN);
serverLog(LL_WARNING,
"Error moving temp DB file %s on the final "
......@@ -1409,7 +1411,7 @@ int rdbSave(char *filename, rdbSaveInfo *rsi) {
tmpfile,
filename,
cwdp ? cwdp : "unknown",
strerror(errno));
str_err);
unlink(tmpfile);
stopSaving(0);
return C_ERR;
......
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