]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
fixperms: use safcm-remote.sync's OpenFileNoFollow()
authorSimon Ruderich <simon@ruderich.org>
Sun, 4 Apr 2021 08:40:13 +0000 (10:40 +0200)
committerSimon Ruderich <simon@ruderich.org>
Mon, 5 Apr 2021 07:41:12 +0000 (09:41 +0200)
cmd/safcm/fixperms.go

index 47e4fb96484db645402ad9cbdb60676e04a041bc..57c081171ed3b71b9ce2937e309874e7ca5d3000 100644 (file)
@@ -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
        }