From 4a34537092d5ae054410646cb0adbfb1df087b99 Mon Sep 17 00:00:00 2001 From: kronwerk Date: Fri, 14 Feb 2025 04:30:13 +0300 Subject: [PATCH] change to 0666 Signed-off-by: kronwerk --- src/aof.c | 6 +++--- src/replication.c | 2 +- src/server.c | 5 ----- src/server.h | 1 - 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/aof.c b/src/aof.c index edc76443d2..70791daa0f 100644 --- a/src/aof.c +++ b/src/aof.c @@ -530,7 +530,7 @@ int writeAofManifestFile(sds buf) { sds tmp_am_name = getTempAofManifestFileName(); sds tmp_am_filepath = makePath(server.aof_dirname, tmp_am_name); - int fd = open(tmp_am_filepath, O_WRONLY | O_TRUNC | O_CREAT, getDataFileMode()); + int fd = open(tmp_am_filepath, O_WRONLY | O_TRUNC | O_CREAT, 0666); if (fd == -1) { serverLog(LL_WARNING, "Can't open the AOF manifest file %s: %s", tmp_am_name, strerror(errno)); @@ -728,7 +728,7 @@ void aofOpenIfNeededOnServerStart(void) { /* Here we should use 'O_APPEND' flag. */ sds aof_filepath = makePath(server.aof_dirname, aof_name); - server.aof_fd = open(aof_filepath, O_WRONLY | O_APPEND | O_CREAT, getDataFileMode()); + server.aof_fd = open(aof_filepath, O_WRONLY | O_APPEND | O_CREAT, 0666); sdsfree(aof_filepath); if (server.aof_fd == -1) { serverLog(LL_WARNING, "Can't open the append-only file %s: %s", aof_name, strerror(errno)); @@ -790,7 +790,7 @@ int openNewIncrAofForAppend(void) { new_aof_name = sdsdup(getNewIncrAofName(temp_am)); } sds new_aof_filepath = makePath(server.aof_dirname, new_aof_name); - newfd = open(new_aof_filepath, O_WRONLY | O_TRUNC | O_CREAT, getDataFileMode()); + newfd = open(new_aof_filepath, O_WRONLY | O_TRUNC | O_CREAT, 0666); sdsfree(new_aof_filepath); if (newfd == -1) { serverLog(LL_WARNING, "Can't open the append-only file %s: %s", new_aof_name, strerror(errno)); diff --git a/src/replication.c b/src/replication.c index 344de3ddf7..869bacf4c4 100644 --- a/src/replication.c +++ b/src/replication.c @@ -3792,7 +3792,7 @@ void syncWithPrimary(connection *conn) { int dfd = -1, maxtries = 5; while (maxtries--) { snprintf(tmpfile, 256, "temp-%d.%ld.rdb", (int)server.unixtime, (long int)getpid()); - dfd = open(tmpfile, O_CREAT | O_WRONLY | O_EXCL, getDataFileMode()); + dfd = open(tmpfile, O_CREAT | O_WRONLY | O_EXCL, 0666); if (dfd != -1) break; /* We save the errno of open to prevent some systems from modifying it after * the sleep call. For example, sleep in Mac will change errno to ETIMEDOUT. */ diff --git a/src/server.c b/src/server.c index 8469815c3c..affc7c4a65 100644 --- a/src/server.c +++ b/src/server.c @@ -6827,11 +6827,6 @@ void serverSetCpuAffinity(const char *cpulist) { #endif } -/* Get data file mode from server. */ -mode_t getDataFileMode(void) { - return ~server.umask & 0666; -} - /* Send a notify message to systemd. Returns sd_notify return code which is * a positive number on success. */ int serverCommunicateSystemd(const char *sd_notify_msg) { diff --git a/src/server.h b/src/server.h index 0452b6c90a..35c6540f1c 100644 --- a/src/server.h +++ b/src/server.h @@ -2594,7 +2594,6 @@ int validateProcTitleTemplate(const char *template); int serverCommunicateSystemd(const char *sd_notify_msg); void serverSetCpuAffinity(const char *cpulist); void dictVanillaFree(void *val); -mode_t getDataFileMode(void); /* ERROR STATS constants */