Skip to content

Commit

Permalink
fs: NewLoopbackDirStream: set O_CLOEXEC
Browse files Browse the repository at this point in the history
Without that, we leak the fd to newly created
subprocesses (if any).

Change-Id: I3a709b7822cf16f1f81a0363942bab0be2531b0f
  • Loading branch information
rfjakob committed Mar 6, 2025
1 parent 216e549 commit e346346
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/dirstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (a *dirArray) Readdirent(ctx context.Context) (de *fuse.DirEntry, errno sys
// NewLoopbackDirStream opens a directory for reading as a DirStream
func NewLoopbackDirStream(name string) (DirStream, syscall.Errno) {
// TODO: should return concrete type.
fd, err := syscall.Open(name, syscall.O_DIRECTORY, 0755)
fd, err := syscall.Open(name, syscall.O_DIRECTORY|syscall.O_CLOEXEC, 0755)
if err != nil {
return nil, ToErrno(err)
}
Expand Down

0 comments on commit e346346

Please # to comment.