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 @@ -69,10 +69,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 @@ -1338,10 +1339,11 @@ static int writeBckVersion(WindowInfo *w
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 @@ -1379,12 +1381,12 @@ static int writeBckVersion(WindowInfo *w
34 perror("nedit: Error reading edited file");
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 @@ -1399,10 +1401,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 @@ -1443,10 +1453,14 @@ static int writeBckVersion(WindowInfo *w
73 + utimbuf.actime = statbuf.st_atime;
74 + utimbuf.modtime = statbuf.st_mtime;
75 + utime(bckname, &utimbuf);