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 36 37 38 39 40
|
Description: Use get_current_dir_name over PATHMAX, etc.
Author: Chris Lamb <lamby@debian.org>
Last-Update: 24-01-2018
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -1471,7 +1471,6 @@
}
static int rdbSaveInternal(int req, const char *filename, rdbSaveInfo *rsi, int rdbflags) {
- char cwd[MAXPATHLEN]; /* Current working dir path for error messages. */
rio rdb;
int error = 0;
int saved_errno;
@@ -1481,7 +1480,7 @@
if (!fp) {
saved_errno = errno;
char *str_err = strerror(errno);
- char *cwdp = getcwd(cwd, MAXPATHLEN);
+ char *cwdp = get_current_dir_name();
serverLog(LL_WARNING,
"Failed opening the temp RDB file %s (in server root dir %s) "
"for saving: %s",
@@ -1551,7 +1550,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());
@@ -1565,7 +1563,7 @@
* if the generate DB file is ok. */
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",
|