diff options
author | CismonX <admin@cismon.net> | 2025-08-12 08:55:42 +0800 |
---|---|---|
committer | Bernd Schubert <bernd@bsbernd.com> | 2025-08-12 23:38:59 +0200 |
commit | 42b9b3bbb71d38be6a5670bbd0948cf406c1573c (patch) | |
tree | 893fc38fd2a300979d8cc04419123146248b5903 /lib/fuse_loop_mt.c | |
parent | 2454ff17512dd0ff8d44ec4a0c35f5fe3aa09d2f (diff) | |
download | libfuse-42b9b3bbb71d38be6a5670bbd0948cf406c1573c.tar.gz |
fuse_loop_mt.c: fix close-on-exec flag on clone fd
Closes: https://github.com/libfuse/libfuse/issues/1310
Signed-off-by: CismonX <admin@cismon.net>
Diffstat (limited to 'lib/fuse_loop_mt.c')
-rw-r--r-- | lib/fuse_loop_mt.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/fuse_loop_mt.c b/lib/fuse_loop_mt.c index 8ee7d49..77712b6 100644 --- a/lib/fuse_loop_mt.c +++ b/lib/fuse_loop_mt.c @@ -271,9 +271,15 @@ static int fuse_clone_chan_fd_default(struct fuse_session *se) strerror(errno)); return -1; } -#ifndef O_CLOEXEC - fcntl(clonefd, F_SETFD, FD_CLOEXEC); -#endif + if (!O_CLOEXEC) { + res = fcntl(clonefd, F_SETFD, FD_CLOEXEC); + if (res == -1) { + fuse_log(FUSE_LOG_ERR, "fuse: failed to set CLOEXEC: %s\n", + strerror(errno)); + close(clonefd); + return -1; + } + } masterfd = se->fd; res = ioctl(clonefd, FUSE_DEV_IOC_CLONE, &masterfd); |