diff options
Diffstat (limited to 'udev/lib/libudev-util.c')
-rw-r--r-- | udev/lib/libudev-util.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 867a41d211..b628fdd44c 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -448,3 +448,15 @@ int udev_util_encode_string(const char *str, char *str_enc, size_t len) err: return -1; } + +void util_set_fd_cloexec(int fd) +{ + int flags; + + flags = fcntl(fd, F_GETFD); + if (flags < 0) + flags = FD_CLOEXEC; + else + flags |= FD_CLOEXEC; + fcntl(fd, F_SETFD, flags); +} |