Skip to content

Commit 2784853

Browse files
committed
archive: set close-on-exec for chmod fallback descriptors
Open temporary descriptors with O_CLOEXEC to prevent inheritance by concurrently started child processes. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 7cc2cbe commit 2784853

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

chmod_unix_nolinux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
//
1515
// Callers must have already excluded symlink entries.
1616
func chmodNoSymlinkFallback(parentFD int, base, name string, perm uint32, _ *archiveoptions.Options) error {
17-
fd, err := unix.Openat(parentFD, base, unix.O_RDONLY|unix.O_NOFOLLOW|unix.O_NONBLOCK, 0)
17+
fd, err := unix.Openat(parentFD, base, unix.O_RDONLY|unix.O_NOFOLLOW|unix.O_NONBLOCK|unix.O_CLOEXEC, 0)
1818
if err != nil {
1919
return &os.PathError{Op: "openat", Path: name, Err: err}
2020
}

0 commit comments

Comments
 (0)