From: Aki Tuomi Date: Thu, 31 Jul 2025 09:23:37 +0000 (+0300) Subject: lib: iostream-rawlog - Do not log errors for permissions X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a35fe6d6358d723831c7b81fdb24776a56e3f62e;p=thirdparty%2Fdovecot%2Fcore.git lib: iostream-rawlog - Do not log errors for permissions If permissions are not sufficient, fail silently. --- diff --git a/src/lib/iostream-rawlog.c b/src/lib/iostream-rawlog.c index 6939d19092..9b36939b7e 100644 --- a/src/lib/iostream-rawlog.c +++ b/src/lib/iostream-rawlog.c @@ -220,16 +220,10 @@ int iostream_rawlog_create(const char *dir, struct istream **input, { static unsigned int counter = 0; const char *timestamp, *prefix; - struct stat st; int ret; if ((ret = iostream_rawlog_try_create_tcp(dir, input, output)) != 0) return ret < 0 ? -1 : 0; - if (stat(dir, &st) < 0) { - if (errno != ENOENT && errno != EACCES) - i_error("rawlog: stat(%s) failed: %m", dir); - return -1; - } timestamp = t_strflocaltime("%Y%m%d-%H%M%S", ioloop_time); @@ -249,14 +243,16 @@ int iostream_rawlog_create_prefix(const char *prefix, struct istream **input, in_path = t_strdup_printf("%s.in", prefix); in_fd = open(in_path, O_CREAT | O_APPEND | O_WRONLY, 0600); if (in_fd == -1) { - i_error("creat(%s) failed: %m", in_path); + if (errno != ENOENT && !ENOACCESS(errno)) + i_error("rawlog: creat(%s) failed: %m", in_path); return -1; } out_path = t_strdup_printf("%s.out", prefix); out_fd = open(out_path, O_CREAT | O_APPEND | O_WRONLY, 0600); if (out_fd == -1) { - i_error("creat(%s) failed: %m", out_path); + if (errno != ENOENT && !ENOACCESS(errno)) + i_error("rawlog: creat(%s) failed: %m", out_path); i_close_fd(&in_fd); i_unlink(in_path); return -1; @@ -285,7 +281,8 @@ int iostream_rawlog_create_path(const char *path, struct istream **input, return ret < 0 ? -1 : 0; fd = open(path, O_CREAT | O_APPEND | O_WRONLY, 0600); if (fd == -1) { - i_error("creat(%s) failed: %m", path); + if (errno != ENOENT && !ENOACCESS(errno)) + i_error("rawlog: creat(%s) failed: %m", path); return -1; } iostream_rawlog_create_fd(fd, path, input, output);