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 @@ -67,10 +67,11 @@ static const char CVSID[] = "$Id: file.c
13 #include <sys/param.h>
20 #include <Xm/ToggleB.h>
21 #include <Xm/FileSB.h>
22 #include <Xm/RowColumn.h>
23 @@ -1359,10 +1360,11 @@ static int writeBckVersion(WindowInfo *w
25 char fullname[MAXPATHLEN], bckname[MAXPATHLEN];
29 + struct utimbuf utimbuf;
30 #define IO_BUFFER_SIZE ((size_t)(1024*1024))
32 /* Do only if version backups are turned on */
33 if (!window->saveOldVersion) {
35 @@ -1388,12 +1390,12 @@ static int writeBckVersion(WindowInfo *w
40 /* Get permissions of the file.
41 - We preserve the normal permissions but not ownership, extended
42 - attributes, et cetera. */
43 + We preserve the normal permissions but not extended attributes,
45 if (fstat(in_fd, &statbuf) != 0) {
49 /* open the destination file exclusive and with restrictive permissions. */
50 @@ -1408,10 +1410,18 @@ static int writeBckVersion(WindowInfo *w
53 return bckError(window, "fchmod() failed", bckname);
56 + /* Set ownership on new file */
57 + if (fchown(out_fd, statbuf.st_uid, statbuf.st_gid) != 0) {
61 + return bckError(window, "fchown() failed", bckname);
64 /* Allocate I/O buffer */
65 io_buffer = (char*) malloc(IO_BUFFER_SIZE);
66 if (NULL == io_buffer) {
69 @@ -1452,10 +1462,14 @@ static int writeBckVersion(WindowInfo *w
75 + utimbuf.actime = statbuf.st_atime;
76 + utimbuf.modtime = statbuf.st_mtime;
77 + utime(bckname, &utimbuf);