extern int default_af_hint;
extern int logfile_format_has_i;
extern int logfile_format_has_o_or_i;
-extern mode_t orig_umask;
extern char *bind_address;
extern char *config_file;
extern char *logfile_format;
if (*lp_prexfer_exec(i) || *lp_postxfer_exec(i)) {
int status;
- umask(orig_umask);
/* For post-xfer exec, fork a new process to run the rsync
* daemon while this process waits for the exit status and
* runs the indicated command at that point. */
set_blocking(fds[1]);
pre_exec_fd = fds[1];
}
- umask(0);
}
#endif
return;
cleanup_set_pid(pid);
- if ((fd = do_open(pid_file, O_WRONLY|O_CREAT|O_EXCL, 0666 & ~orig_umask)) == -1) {
+ if ((fd = do_open(pid_file, O_WRONLY|O_CREAT|O_EXCL, 0666)) == -1) {
failure:
cleanup_set_pid(0);
fprintf(stderr, "failed to create pid file %s: %s\n", pid_file, strerror(errno));
exit_cleanup(RERR_SYNTAX);
}
- /* we set a 0 umask so that correct file permissions can be
- * carried across */
- orig_umask = umask(0);
+ /* Get the umask for use in permission calculations. We no longer set
+ * it to zero; that is ugly and pointless now that all the callers that
+ * relied on it have been reeducated to work with default ACLs. */
+ umask(orig_umask = umask(0));
#if defined CONFIG_LOCALE && defined HAVE_SETLOCALE
setlocale(LC_CTYPE, "");
extern int blocking_io;
extern int filesfrom_fd;
extern int munge_symlinks;
-extern mode_t orig_umask;
extern char *logfile_name;
extern int remote_option_cnt;
extern const char **remote_options;
close(to_child_pipe[0]);
if (from_child_pipe[1] != STDOUT_FILENO)
close(from_child_pipe[1]);
- umask(orig_umask);
set_blocking(STDIN_FILENO);
if (blocking_io > 0)
set_blocking(STDOUT_FILENO);
int relative_paths = 0;
int module_dirlen = 0;
int preserve_xattrs = 0;
-mode_t orig_umask = 002;
char number_separator = ',';
char *partial_dir;
char *module_dir;
extern int preserve_xattrs;
extern char *module_dir;
extern unsigned int module_dirlen;
-extern mode_t orig_umask;
extern char *partial_dir;
extern filter_rule_list daemon_filter_list;
}
}
-/* This creates a new directory with default permissions. Since there
- * might be some directory-default permissions affecting this, we can't
- * force the permissions directly using the original umask and mkdir(). */
+/* 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)
{
- int ret;
-
- umask(orig_umask);
- ret = do_mkdir(fname, ACCESSPERMS);
- umask(0);
-
- return ret;
+ return do_mkdir(fname, ACCESSPERMS);
}
/* Create any necessary directories in fname. Any missing directories are
} else
end = fname + strlen(fname);
- umask(orig_umask); /* NOTE: don't return before setting this back to 0! */
-
/* Try to find an existing dir, starting from the deepest dir. */
for (p = end; ; ) {
if (do_mkdir(fname, ACCESSPERMS) == 0) {
ret++;
}
- umask(0);
-
if (flags & MKP_DROP_NAME)
*end = '/';