1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
From: Chris Lamb <lamby@debian.org>
Date: Wed, 24 Jan 2018 22:06:35 +1100
Subject: Use get_current_dir_name over PATHMAX, etc.
Forwarded: not-needed
src/rdb.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
@@ -1505,7 +1505,6 @@
/* Save the DB on disk. Return C_ERR on error, C_OK on success. */
int rdbSave(int req, char *filename, rdbSaveInfo *rsi, int rdbflags) {
char tmpfile[256];
- char cwd[MAXPATHLEN]; /* Current working dir path for error messages. */
startSaving(rdbflags);
snprintf(tmpfile,256,"temp-%d.rdb", (int) getpid());
@@ -1520,6 +1520,6 @@
if (rename(tmpfile,filename) == -1) {
char *str_err = strerror(errno);
- char *cwdp = getcwd(cwd,MAXPATHLEN);
+ char *cwdp = get_current_dir_name();
serverLog(LL_WARNING,
"Error moving temp DB file %s on the final "
"destination %s (in server root dir %s): %s",
@@ -1529,6 +1528,7 @@
str_err);
unlink(tmpfile);
stopSaving(0);
+ zfree(cwdp);
return C_ERR;
}
if (fsyncFileDir(filename) != 0) {
|