diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2005-09-18 11:47:25 +0000 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2005-09-18 11:47:25 +0000 |
commit | 75a6738bffb9e0868fdab575a61f08926d2cf167 (patch) | |
tree | b02ad671f1f7b2d3b1999392e51677c0cdd1c5cc /lib/backup-files.c | |
parent | cca912b13a9df210d2275ea3def313b403456505 (diff) | |
download | quilt-75a6738bffb9e0868fdab575a61f08926d2cf167.tar.gz |
- lib/backup-files.c: add missing dependency on config.h. Check
for chmod and fchmod support. Remove two unnecessary chmod calls.
- Makefile.in: fix cyclic dependency on Makefile.
Diffstat (limited to 'lib/backup-files.c')
-rw-r--r-- | lib/backup-files.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/backup-files.c b/lib/backup-files.c index 3d2d183..831379f 100644 --- a/lib/backup-files.c +++ b/lib/backup-files.c @@ -166,7 +166,11 @@ link_or_copy(const char *from, struct stat *st, const char *to) close(from_fd); return 1; } +#if defined(HAVE_FCHMOD) (void) fchmod(to_fd, st->st_mode); +#elif defined(HAVE_CHMOD) + (void) chmod(to, st->st_mode); +#endif if (copy(from_fd, to_fd)) { fprintf(stderr, "%s -> %s: %s\n", from, to, strerror(errno)); unlink(to); @@ -217,7 +221,11 @@ ensure_nolinks(const char *filename) goto fail; if (copy(from_fd, to_fd)) goto fail; - (void) fchmod(to_fd, st.st_mode); +#if defined(HAVE_FCHMOD) + (void) fchmod(to_fd, st.st_mode); +#elif defined(HAVE_CHMOD) + (void) chmod(tmpname, st.st_mode); +#endif if (rename(tmpname, filename)) goto fail; @@ -299,16 +307,9 @@ process_file(const char *file) goto fail; } } - if (!(st.st_mode & S_IWUSR)) { - /* Change mode of backup file so that we - can later remove it. */ - chmod(backup, st.st_mode | S_IWUSR); - } unlink(backup); remove_parents(backup); } else if (opt_what == what_remove) { - /* Change mode of backup file so that we can remove it. */ - chmod(backup, S_IWUSR); unlink(backup); remove_parents(backup); } else if (opt_what == what_noop) { |