From: Simon Ruderich Date: Thu, 3 Jun 2021 08:46:51 +0000 (+0200) Subject: remote: retain setgid/sticky when temporarily chmodding directories X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=1fba102ea14d034cb0ad0909ce11325be4ce82b0;p=safcm%2Fsafcm.git remote: retain setgid/sticky when temporarily chmodding directories --- diff --git a/remote/sync/files.go b/remote/sync/files.go index a11b77e..e110b52 100644 --- a/remote/sync/files.go +++ b/remote/sync/files.go @@ -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 {