I wrote a small patch to maintain modification times of rzip.
The unified diff is included. It was straightforward.

I have not done any autoconf things for the header file rzip.h.

Thanks,
  David
--- rzip.h.orig 2003-10-08 00:08:28.000000000 +0200
+++ rzip.h      2005-08-28 23:06:45.000000000 +0200
@@ -33,6 +33,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <netinet/in.h>
+#include <utime.h>
+#include <sys/stat.h>
 
 #ifdef HAVE_STRING_H
 #include <string.h>
--- main.c.orig 2005-08-24 01:00:20.000000000 +0200
+++ main.c      2005-08-28 23:17:29.000000000 +0200
@@ -128,6 +128,9 @@
        int fd_in, fd_out = -1, fd_hist = -1;
        off_t expected_size;
 
+        struct stat sb;
+        struct utimbuf utb;
+
        if (control->outname) {
                control->outfile = strdup(control->outname);
        } else {
@@ -143,6 +146,8 @@
                                           strlen(control->suffix));
        }
 
+        stat(control->infile,&sb);
+
        fd_in = open(control->infile,O_RDONLY);
        if (fd_in == -1) {
                fatal("Failed to open %s: %s\n", 
@@ -190,6 +195,10 @@
                }
        }
 
+        utb.actime=sb.st_atime;
+        utb.modtime=sb.st_mtime;
+        utime(control->outfile,&utb);
+
        free(control->outfile);
 }
 
@@ -199,6 +208,8 @@
 static void compress_file(struct rzip_control *control)
 {
        int fd_in, fd_out;
+        struct stat sb;
+        struct utimbuf utb;
 
        if (strlen(control->suffix) <= strlen(control->infile) &&
            strcmp(control->suffix, control->infile + strlen(control->infile) - 
strlen(control->suffix)) == 0) {
@@ -218,6 +229,8 @@
                strcat(control->outfile, control->suffix);
        }
 
+        stat(control->infile,&sb);
+
        fd_in = open(control->infile,O_RDONLY);
        if (fd_in == -1) {
                fatal("Failed to open %s: %s\n", control->infile, 
strerror(errno));
@@ -248,6 +261,10 @@
                }
        }
 
+        utb.actime=sb.st_atime;
+        utb.modtime=sb.st_mtime;
+        utime(control->outfile,&utb);
+
        free(control->outfile);
 }
 

Reply via email to