File: 0003-Use-get_current_dir_name-over-PATHMAX.patch

package info (click to toggle)
valkey 8.0.1%2Bdfsg1-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 21,136 kB
  • sloc: ansic: 204,786; tcl: 49,951; sh: 4,625; perl: 4,214; makefile: 1,969; python: 1,396; ruby: 886; cpp: 522; javascript: 30; csh: 7
file content (40 lines) | stat: -rw-r--r-- 1,515 bytes parent folder | download
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",