summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2004-06-02 08:38:52 +0000
committerAndreas Gruenbacher <agruen@suse.de>2004-06-02 08:38:52 +0000
commit029024c018e455dc7d5699d64036582844a86417 (patch)
tree5453d09110312af693d48b8ac5eec8b35df34d58 /lib
parent4c561530fb643c46cc0d903ea518788bb1665bdb (diff)
downloadquilt-029024c018e455dc7d5699d64036582844a86417.tar.gz
- Fix from Dean Roehrich <roehrich@sgi.com>: Preserve file mode
of original file when creating backup files.
Diffstat (limited to 'lib')
-rw-r--r--lib/backup-files.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/backup-files.c b/lib/backup-files.c
index 462ce4f..5f37ef5 100644
--- a/lib/backup-files.c
+++ b/lib/backup-files.c
@@ -137,6 +137,7 @@ link_or_copy(const char *from, struct stat *st, const char *to)
close(from_fd);
return 1;
}
+ (void) fchmod(to_fd, st->st_mode);
if (copy(from_fd, to_fd)) {
fprintf(stderr, "%s -> %s: %s\n", from, to, strerror(errno));
unlink(to);
@@ -187,6 +188,7 @@ ensure_nolinks(const char *filename)
goto fail;
if (copy(from_fd, to_fd))
goto fail;
+ (void) fchmod(to_fd, st.st_mode);
if (rename(tmpname, filename))
goto fail;