-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/archive: Use archive_unix.go on FreeBSD
Almost all the code can be shared between Linux, FreeBSD and Darwin with the only different in the handling of lchmod. On FreeBSD and Darwin (and probably other BSDs) we can access lchmod functionality via unix.Fchmodat. Signed-off-by: Doug Rabson <[email protected]>
- Loading branch information
Showing
4 changed files
with
40 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//go:build freebsd || darwin | ||
// +build freebsd darwin | ||
|
||
package archive | ||
|
||
import ( | ||
"archive/tar" | ||
"os" | ||
|
||
"golang.org/x/sys/unix" | ||
) | ||
|
||
func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo, forceMask *os.FileMode) error { | ||
permissionsMask := hdrInfo.Mode() | ||
if forceMask != nil { | ||
permissionsMask = *forceMask | ||
} | ||
return unix.Fchmodat(unix.AT_FDCWD, path, uint32(permissionsMask), unix.AT_SYMLINK_NOFOLLOW) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters