1042
|
1 |
#! /bin/sh /usr/share/dpatch/dpatch-run
|
|
2 |
## 10_maintain_times.dpatch by David Frey <[email protected]>
|
|
3 |
##
|
|
4 |
## All lines beginning with `## DP:' are a description of the patch.
|
|
5 |
## DP: Maintain modification times.
|
|
6 |
|
|
7 |
@DPATCH@
|
|
8 |
diff -urNad rzip-2.1~/main.c rzip-2.1/main.c
|
|
9 |
--- rzip-2.1~/main.c 2006-02-14 00:38:23.000000000 +0000
|
|
10 |
+++ rzip-2.1/main.c 2006-03-13 15:52:17.000000000 +0000
|
|
11 |
@@ -128,6 +128,8 @@
|
|
12 |
{
|
|
13 |
int fd_in, fd_out = -1, fd_hist = -1;
|
|
14 |
off_t expected_size;
|
|
15 |
+ struct stat sb;
|
|
16 |
+ struct utimbuf utb;
|
|
17 |
|
|
18 |
if (control->outname) {
|
|
19 |
control->outfile = strdup(control->outname);
|
|
20 |
@@ -143,6 +145,8 @@
|
|
21 |
control->outfile[strlen(control->infile) - strlen(control->suffix)] = 0;
|
|
22 |
}
|
|
23 |
|
|
24 |
+ stat(control->infile,&sb);
|
|
25 |
+
|
|
26 |
fd_in = open(control->infile,O_RDONLY);
|
|
27 |
if (fd_in == -1) {
|
|
28 |
fatal("Failed to open %s: %s\n",
|
|
29 |
@@ -190,6 +194,10 @@
|
|
30 |
}
|
|
31 |
}
|
|
32 |
|
|
33 |
+ utb.actime=sb.st_atime;
|
|
34 |
+ utb.modtime=sb.st_mtime;
|
|
35 |
+ utime(control->outfile,&utb);
|
|
36 |
+
|
|
37 |
free(control->outfile);
|
|
38 |
}
|
|
39 |
|
|
40 |
@@ -199,6 +207,8 @@
|
|
41 |
static void compress_file(struct rzip_control *control)
|
|
42 |
{
|
|
43 |
int fd_in, fd_out;
|
|
44 |
+ struct stat sb;
|
|
45 |
+ struct utimbuf utb;
|
|
46 |
|
|
47 |
if (strlen(control->suffix) <= strlen(control->infile) &&
|
|
48 |
strcmp(control->suffix, control->infile + strlen(control->infile) - strlen(control->suffix)) == 0) {
|
|
49 |
@@ -218,6 +228,8 @@
|
|
50 |
strcat(control->outfile, control->suffix);
|
|
51 |
}
|
|
52 |
|
|
53 |
+ stat(control->infile,&sb);
|
|
54 |
+
|
|
55 |
fd_in = open(control->infile,O_RDONLY);
|
|
56 |
if (fd_in == -1) {
|
|
57 |
fatal("Failed to open %s: %s\n", control->infile, strerror(errno));
|
|
58 |
@@ -248,6 +260,10 @@
|
|
59 |
}
|
|
60 |
}
|
|
61 |
|
|
62 |
+ utb.actime=sb.st_atime;
|
|
63 |
+ utb.modtime=sb.st_mtime;
|
|
64 |
+ utime(control->outfile,&utb);
|
|
65 |
+
|
|
66 |
free(control->outfile);
|
|
67 |
}
|
|
68 |
|
|
69 |
diff -urNad rzip-2.1~/rzip.h rzip-2.1/rzip.h
|
|
70 |
--- rzip-2.1~/rzip.h 2006-02-14 00:38:23.000000000 +0000
|
|
71 |
+++ rzip-2.1/rzip.h 2006-03-13 15:44:26.000000000 +0000
|
|
72 |
@@ -33,6 +33,8 @@
|
|
73 |
#include <stdlib.h>
|
|
74 |
#include <string.h>
|
|
75 |
#include <netinet/in.h>
|
|
76 |
+#include <utime.h>
|
|
77 |
+#include <sys/stat.h>
|
|
78 |
|
|
79 |
#ifdef HAVE_STRING_H
|
|
80 |
#include <string.h>
|