3 source/file.c | 18 ++++++++++++++++--
4 1 files changed, 16 insertions(+), 2 deletions(-)
6 diff --quilt old/source/file.c new/source/file.c
9 @@ -67,10 +67,11 @@ static const char CVSID[] = "$Id: file.c
11 #include <sys/param.h>
18 #include <Xm/ToggleB.h>
19 #include <Xm/FileSB.h>
20 #include <Xm/RowColumn.h>
21 @@ -1337,10 +1338,11 @@ static int writeBckVersion(WindowInfo *w
23 char fullname[MAXPATHLEN], bckname[MAXPATHLEN];
27 + struct utimbuf utimbuf;
28 #define IO_BUFFER_SIZE ((size_t)(1024*1024))
30 /* Do only if version backups are turned on */
31 if (!window->saveOldVersion) {
33 @@ -1366,12 +1368,12 @@ static int writeBckVersion(WindowInfo *w
38 /* Get permissions of the file.
39 - We preserve the normal permissions but not ownership, extended
40 - attributes, et cetera. */
41 + We preserve the normal permissions but not extended attributes,
43 if (fstat(in_fd, &statbuf) != 0) {
47 /* open the destination file exclusive and with restrictive permissions. */
48 @@ -1386,10 +1388,18 @@ static int writeBckVersion(WindowInfo *w
51 return bckError(window, "fchmod() failed", bckname);
54 + /* Set ownership on new file */
55 + if (fchown(out_fd, statbuf.st_uid, statbuf.st_gid) != 0) {
59 + return bckError(window, "fchown() failed", bckname);
62 /* Allocate I/O buffer */
63 io_buffer = (char*) malloc(IO_BUFFER_SIZE);
64 if (NULL == io_buffer) {
67 @@ -1430,10 +1440,14 @@ static int writeBckVersion(WindowInfo *w
73 + utimbuf.actime = statbuf.st_atime;
74 + utimbuf.modtime = statbuf.st_mtime;
75 + utime(bckname, &utimbuf);