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 #include #include +#include +#include #ifdef WITH_SELINUX #include @@ -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);