Skip to content

Commit

Permalink
Merge pull request #2074 from dfr/freebsd-exists
Browse files Browse the repository at this point in the history
pkg/fileutils: fix Lexists on FreeBSD (second attempt)
  • Loading branch information
openshift-merge-bot[bot] authored Aug 25, 2024
2 parents 4e18d1f + 7afe759 commit 9a14315
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/fileutils/exists_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ func Lexists(path string) error {
// faccessat. In this case, the call to faccessat will return EINVAL and
// we fall back to using Lstat.
err := unix.Faccessat(unix.AT_FDCWD, path, unix.F_OK, unix.AT_SYMLINK_NOFOLLOW)
if err != nil && errors.Is(err, syscall.EINVAL) {
_, err = os.Lstat(path)
}
if err != nil {
if errors.Is(err, syscall.EINVAL) {
_, err = os.Lstat(path)
return err
}
return &os.PathError{Op: "faccessat", Path: path, Err: err}
}
return nil
Expand Down

0 comments on commit 9a14315

Please sign in to comment.