From: Simon Ruderich Date: Sun, 4 Apr 2021 08:40:13 +0000 (+0200) Subject: fixperms: use safcm-remote.sync's OpenFileNoFollow() X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=b93e20c0f845841143e13ca421f1c9d4b79304b7;hp=713cde4bd701dd53ed46d01f43c9e9e7b82dc514;p=safcm%2Fsafcm.git fixperms: use safcm-remote.sync's OpenFileNoFollow() --- diff --git a/cmd/safcm/fixperms.go b/cmd/safcm/fixperms.go index 47e4fb9..57c0811 100644 --- a/cmd/safcm/fixperms.go +++ b/cmd/safcm/fixperms.go @@ -23,8 +23,8 @@ import ( "log" "os" "path/filepath" - "syscall" + "ruderich.org/simon/safcm/cmd/safcm-remote/sync" "ruderich.org/simon/safcm/cmd/safcm/config" ) @@ -101,8 +101,7 @@ func fixpermsWalkDirFunc(path string, d fs.DirEntry, err error) error { // chmodNoFollow works like os.Chmod but doesn't follow symlinks. func chmodNoFollow(path string, mode fs.FileMode) error { - x, err := os.OpenFile(path, - os.O_RDONLY|syscall.O_NOFOLLOW|syscall.O_NONBLOCK, 0) + x, err := sync.OpenFileNoFollow(path) if err != nil { return err }