use an explicit chmod to make sure the bits are set correctly
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 27 Feb 2009 01:07:34 +0000 (12:07 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 27 Feb 2009 01:07:34 +0000 (12:07 +1100)
migrate/remote-cache.c

index 8ba2d1e62c9d5731678914d596f5283024a94731..4114a88856e09210f7f107c02a02f26d7f6f76d9 100644 (file)
@@ -1407,14 +1407,19 @@ static int migrate_small_file_immed(TALLOC_CTX *mem_ctx, char *old_path, char *n
                ret = -EIO;
                goto finished;
        }
+       ret = 0;
 
        if (chown(new_tmppath, st->st_uid, st->st_gid) == -1) {
-               DEBUG(DEBUG_ERR, (__location__ " fchown for migrated file %s failed with %s\n", new_tmppath, strerror(errno)));
+               DEBUG(DEBUG_ERR, (__location__ " chown for migrated file %s failed with %s\n", new_tmppath, strerror(errno)));
                ret = -errno;
                goto finished;
        }
-       ret = 0;
 
+       if (chmod(new_tmppath, st->st_mode) == -1) {
+               DEBUG(DEBUG_ERR, (__location__ " chmod for migrated file %s failed with %s\n", new_tmppath, strerror(errno)));
+               ret = -errno;
+               goto finished;
+       }
        times.actime  = st->st_atime;
        times.modtime = st->st_mtime;
        if (utime(new_tmppath, &times) == -1) {