summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-admin/logrotate/files/logrotate-3.8.8-atomic-create.patch')
-rw-r--r--app-admin/logrotate/files/logrotate-3.8.8-atomic-create.patch45
1 files changed, 0 insertions, 45 deletions
diff --git a/app-admin/logrotate/files/logrotate-3.8.8-atomic-create.patch b/app-admin/logrotate/files/logrotate-3.8.8-atomic-create.patch
deleted file mode 100644
index 281612531262..000000000000
--- a/app-admin/logrotate/files/logrotate-3.8.8-atomic-create.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-diff -Nuar a/logrotate.c b/logrotate.c
---- a/logrotate.c 2014-10-16 13:12:35.000000000 +0200
-+++ b/logrotate.c 2014-11-04 20:26:46.080067315 +0100
-@@ -359,15 +359,20 @@
- int createOutputFile(char *fileName, int flags, struct stat *sb, acl_type acl, int force_mode)
- {
- int fd;
-- struct stat sb_create;
-- int acl_set = 0;
--
-- fd = open(fileName, (flags | O_EXCL | O_NOFOLLOW),
-- (S_IRUSR | S_IWUSR) & sb->st_mode);
-+ int acl_set = 0;
-+ struct stat sb_create;
-+ char template[PATH_MAX + 1];
-+ char *fname;
-+ mode_t umask_value;
-+ snprintf(template, PATH_MAX, "%s/logrotate_temp.XXXXXX", ourDirName(fileName));
-+ umask_value = umask(0000);
-+ fname = mktemp(template);
-+ fd = open(fname, (flags | O_EXCL | O_NOFOLLOW), (S_IRUSR | S_IWUSR) & sb->st_mode);
-+ umask(umask_value);
-
- if (fd < 0) {
-- message(MESS_ERROR, "error creating output file %s: %s\n",
-- fileName, strerror(errno));
-+ message(MESS_ERROR, "error creating unique temp file: %s\n",
-+ strerror(errno));
- return -1;
- }
- if (fchmod(fd, (S_IRUSR | S_IWUSR) & sb->st_mode)) {
-@@ -418,6 +423,13 @@
- }
- }
-
-+ if (rename(template, fileName)) {
-+ message(MESS_ERROR, "error renaming temp file to %s: %s\n",
-+ fileName, strerror(errno));
-+ close(fd);
-+ return -1;
-+ }
-+
- return fd;
- }
-