- if (!S_ISLNK(st->st_mode)) {
-- if ((st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) {
-+ mode_t mode = file->mode; /* file->mode shouldn't be modified */
-+ if (am_daemon) {
-+ if (S_ISDIR(st->st_mode)) {
-+ mode = (mode & lp_directory_mask(module_id))
-+ | lp_force_directory_mode(module_id);
-+ } else {
-+ mode = (mode & lp_create_mask(module_id))
-+ | lp_force_create_mode(module_id);
-+ }
-+ }
-+ if ((st->st_mode & CHMOD_BITS) != (mode & CHMOD_BITS)) {
- updated = 1;
-- if (do_chmod(fname,(file->mode & CHMOD_BITS)) != 0) {
-+ if (do_chmod(fname, (mode & CHMOD_BITS)) != 0) {
- rsyserr(FERROR, errno, "failed to set permissions on %s",
- full_fname(fname));
- return 0;
---- orig/rsyncd.conf.yo 2005-06-03 08:32:34
+- if ((st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) {
+- int ret = do_chmod(fname, file->mode);
++ if ((st->st_mode & CHMOD_BITS) != (mode & CHMOD_BITS)) {
++ int ret = do_chmod(fname, mode);
+ if (ret < 0) {
+ rsyserr(FERROR, errno,
+ "failed to set permissions on %s",
+--- orig/rsyncd.conf.yo 2005-07-07 23:11:09