Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid a non-writable-by-the-user file when copying xattrs.
[rsync/rsync.git]
/
util.c
diff --git
a/util.c
b/util.c
index
2c4c571
..
9d5f180
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-177,13
+177,6
@@
int set_modtime(const char *fname, time_t modtime, uint32 mod_nsec, mode_t mode)
}
}
}
}
-/* This creates a new directory with default permissions. Now that we
- * leave the original umask set, we can just mkdir with mode 777. */
-int mkdir_defmode(char *fname)
-{
- return do_mkdir(fname, ACCESSPERMS);
-}
-
/* Create any necessary directories in fname. Any missing directories are
* created with default permissions. Returns < 0 on error, or the number
* of directories created. */
/* Create any necessary directories in fname. Any missing directories are
* created with default permissions. Returns < 0 on error, or the number
* of directories created. */
@@
-336,6
+329,11
@@
int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
return -1;
}
return -1;
}
+#ifdef SUPPORT_XATTRS
+ if (preserve_xattrs)
+ mode |= S_IWUSR;
+#endif
+ mode &= INITACCESSPERMS;
if ((ofd = do_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode)) < 0) {
int save_errno = errno;
rsyserr(FERROR_XFER, save_errno, "open %s", full_fname(dest));
if ((ofd = do_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode)) < 0) {
int save_errno = errno;
rsyserr(FERROR_XFER, save_errno, "open %s", full_fname(dest));