X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=remote%2Fsync%2Ffiles.go;h=507cc174010bdb68ba0d478d07001fe5b66167d2;hb=8620dac1f9ee7f73058e3e97b488ec0c710a89df;hp=a11b77e8107d8265ed33dac5acfeaf8aa89a4e6e;hpb=ca3a64ec7f80ee21f167fd2b1b3de03349c65028;p=safcm%2Fsafcm.git diff --git a/remote/sync/files.go b/remote/sync/files.go index a11b77e..507cc17 100644 --- a/remote/sync/files.go +++ b/remote/sync/files.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +//go:build !windows // +build !windows package sync @@ -324,7 +325,7 @@ reopen: err := unix.Unlinkat(parentFd, baseName, 0) if err != nil && !os.IsNotExist(err) { err2 := unix.Unlinkat(parentFd, baseName, - AT_REMOVEDIR) + unix.AT_REMOVEDIR) if err2 != nil && !os.IsNotExist(err2) { // See src/os/file_unix.go in Go's sources if err2 == unix.ENOTDIR { @@ -383,6 +384,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 {