diff options
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/select.c b/src/select.c index 4ea95362..4b002ae5 100644 --- a/src/select.c +++ b/src/select.c @@ -47,6 +47,15 @@ int osmo_fd_register(struct osmo_fd *fd) if (flags < 0) return flags; + /* set close-on-exec flag */ + flags = fcntl(fd->fd, F_GETFD); + if (flags < 0) + return flags; + flags |= FD_CLOEXEC; + flags = fcntl(fd->fd, F_SETFD, flags); + if (flags < 0) + return flags; + /* Register FD */ if (fd->fd > maxfd) maxfd = fd->fd; |