~ubuntu-branches/ubuntu/hardy/logrotate/hardy-updates

« back to all changes in this revision

Viewing changes to debian/patches/compressutime.patch

  • Committer: Bazaar Package Importer
  • Author(s): Paul Martin
  • Date: 2006-04-08 23:02:19 UTC
  • mfrom: (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20060408230219-7moi9qw2g42w1nye
Tags: 3.7.1-3
* Patch debian/control to fix FTBFS on kfreebsd-amd64. Perhaps we need
  a build-depends macro for !kfreebsd. (Closes: #361465)
* Use and depend on debhelper version 5.
* Switch from dpatch to quilt.
* cpp-crossbuild.patch: change from using $(CPP) to $(CC) -E.
  Thanks to NIIBE Yutaka. (Closes: #284040)
* dst.patch: fix mktime initialisation so that daylight savings is
  taken into account. Thanks to Holger Weiss. (Closes: #278591)
* man-333996.patch: fix typos in logrotate.8 where "then" should be
  "than". Thanks to Adrian Knoth. (Closes: #333996)
* manpage.patch: Apply missed fixes from #101272. Thanks to J S Bygott.
  (Closes: #335060)
* script-argument.patch: Allow the use of $1 in scripts again.
  (Closes: #330783)
* README.Debian: Document that sysklogd does its own log rotation.
  (Closes: #308963)
* README.Debian: Document how scripts are called. (Closes: #308920)
* Update the copyright file.
* debian/control: remove versioned dependency on cron. The version of
  cron forbidden pre-dates woody (currently "oldstable") by several
  years. This versioned dependency is preventing logrotate being
  installed with bcron. (Closes: #304038, #349150)
* debian/rules: Fix backports, allowing them to use selinux.
  (Closes: #340363)
* uncompressChild-warning.patch: Fix a "might be used uninitialised" 
  warning from gcc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Preserve mtime/atime on compression. (Closes: #286957)
 
2
 
 
3
--- ./logrotate.c       2005-09-03 14:07:42.000000000 +0100
 
4
+++ /tmp/dpep-work.m2M7hf/logrotate-3.7.1/logrotate.c   2005-09-03 14:08:14.000000000 +0100
 
5
@@ -12,6 +12,8 @@
 
6
 #include <time.h>
 
7
 #include <unistd.h>
 
8
 #include <glob.h>
 
9
+#include <sys/types.h>
 
10
+#include <utime.h>
 
11
 
 
12
 #ifdef WITH_SELINUX
 
13
 #include <selinux/selinux.h>
 
14
@@ -120,6 +122,7 @@
 
15
 static int compressLogFile(char * name, logInfo * log, struct stat *sb) {
 
16
     char * compressedName;
 
17
     const char ** fullCommand;
 
18
+    struct utimbuf utim;
 
19
     int inFile;
 
20
     int outFile;
 
21
     int i;
 
22
@@ -190,6 +193,12 @@
 
23
        message(MESS_ERROR, "failed to compress log %s\n", name);
 
24
        return 1;
 
25
     }
 
26
+   
 
27
+    utim.actime = sb->st_atime;
 
28
+    utim.modtime = sb->st_mtime;
 
29
+    utime(compressedName,&utim);
 
30
+    /* If we can't change atime/mtime, it's not a disaster.
 
31
+       It might possibly fail under SELinux. */
 
32
 
 
33
     unlink(name);
 
34