Commit 55260d4a authored by Shayan Pooya's avatar Shayan Pooya Committed by Han-Wen Nienhuys

Close the fuse file descriptor on exec

When a process forks and execs a new process, the child will not be
interested in the parent's file descriptor to /dev/fuse.
Signed-off-by: default avatarShayan Pooya <shayan@arista.com>
parent ae405425
...@@ -70,6 +70,11 @@ func mount(mountPoint string, opts *MountOptions, ready chan<- error) (fd int, e ...@@ -70,6 +70,11 @@ func mount(mountPoint string, opts *MountOptions, ready chan<- error) (fd int, e
return -1, err return -1, err
} }
// golang sets CLOEXEC on file descriptors when they are
// acquired through normal operations (e.g. open).
// Buf for fd, we have to set CLOEXEC manually
syscall.CloseOnExec(fd)
close(ready) close(ready)
return fd, err return fd, err
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment