1 Subject: keep the file times for backup files
5 source/file.c | 18 ++++++++++++++++--
6 1 file changed, 16 insertions(+), 2 deletions(-)
8 diff --quilt old/source/file.c new/source/file.c
11 @@ -69,6 +69,7 @@ static const char CVSID[] = "$Id: file.c
18 #include <Xm/ToggleB.h>
19 @@ -1394,6 +1395,7 @@ static int writeBckVersion(WindowInfo *w
23 + struct utimbuf utimbuf;
24 #define IO_BUFFER_SIZE ((size_t)(1024*1024))
26 /* Do only if version backups are turned on */
27 @@ -1423,8 +1425,8 @@ static int writeBckVersion(WindowInfo *w
30 /* Get permissions of the file.
31 - We preserve the normal permissions but not ownership, extended
32 - attributes, et cetera. */
33 + We preserve the normal permissions but not extended attributes,
35 if (fstat(in_fd, &statbuf) != 0) {
38 @@ -1443,6 +1445,14 @@ static int writeBckVersion(WindowInfo *w
39 return bckError(window, "fchmod() failed", bckname);
42 + /* Set ownership on new file */
43 + if (fchown(out_fd, statbuf.st_uid, statbuf.st_gid) != 0) {
47 + return bckError(window, "fchown() failed", bckname);
50 /* Allocate I/O buffer */
51 io_buffer = (char*) malloc(IO_BUFFER_SIZE);
52 if (NULL == io_buffer) {
53 @@ -1495,6 +1505,10 @@ static int writeBckVersion(WindowInfo *w
57 + utimbuf.actime = statbuf.st_atime;
58 + utimbuf.modtime = statbuf.st_mtime;
59 + utime(bckname, &utimbuf);