diff options
Diffstat (limited to 'patches/logrotate-3.7.1/compressutime.patch')
-rw-r--r-- | patches/logrotate-3.7.1/compressutime.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/patches/logrotate-3.7.1/compressutime.patch b/patches/logrotate-3.7.1/compressutime.patch new file mode 100644 index 000000000..e2da5cba2 --- /dev/null +++ b/patches/logrotate-3.7.1/compressutime.patch @@ -0,0 +1,34 @@ +Preserve mtime/atime on compression. (Closes: #286957) + +--- ./logrotate.c 2005-09-03 14:07:42.000000000 +0100 ++++ /tmp/dpep-work.m2M7hf/logrotate-3.7.1/logrotate.c 2005-09-03 14:08:14.000000000 +0100 +@@ -12,6 +12,8 @@ + #include <time.h> + #include <unistd.h> + #include <glob.h> ++#include <sys/types.h> ++#include <utime.h> + + #ifdef WITH_SELINUX + #include <selinux/selinux.h> +@@ -120,6 +122,7 @@ + static int compressLogFile(char * name, logInfo * log, struct stat *sb) { + char * compressedName; + const char ** fullCommand; ++ struct utimbuf utim; + int inFile; + int outFile; + int i; +@@ -190,6 +193,12 @@ + message(MESS_ERROR, "failed to compress log %s\n", name); + return 1; + } ++ ++ utim.actime = sb->st_atime; ++ utim.modtime = sb->st_mtime; ++ utime(compressedName,&utim); ++ /* If we can't change atime/mtime, it's not a disaster. ++ It might possibly fail under SELinux. */ + + unlink(name); + |