]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
remote: retain setgid/sticky when temporarily chmodding directories
authorSimon Ruderich <simon@ruderich.org>
Thu, 3 Jun 2021 08:46:51 +0000 (10:46 +0200)
committerSimon Ruderich <simon@ruderich.org>
Thu, 3 Jun 2021 08:46:51 +0000 (10:46 +0200)
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
                        // 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 {
                        debugf("chmodding %#o (temporary)", mode)
                        err := oldFh.Chmod(mode)
                        if err != nil {