]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - remote/sync/files.go
remote: retain setgid/sticky when temporarily chmodding directories
[safcm/safcm.git] / remote / sync / files.go
index a11b77e8107d8265ed33dac5acfeaf8aa89a4e6e..e110b526011f577815ecbb9660a792f104743bef 100644 (file)
@@ -383,6 +383,10 @@ reopen:
                        // the error when the user tries to access this
                        // directory (access for the group will fail though).
                        mode := change.Old.Mode & fs.ModePerm & 0700
+                       // Retain setgid/sticky so that the behavior does not
+                       // change when creating and removing files.
+                       mode |= change.Old.Mode & fs.ModeSetgid
+                       mode |= change.Old.Mode & fs.ModeSticky
                        debugf("chmodding %#o (temporary)", mode)
                        err := oldFh.Chmod(mode)
                        if err != nil {