From 029024c018e455dc7d5699d64036582844a86417 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Wed, 2 Jun 2004 08:38:52 +0000 Subject: - Fix from Dean Roehrich : Preserve file mode of original file when creating backup files. --- lib/backup-files.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') 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; -- cgit