summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-10-30 12:31:59 +0100
committerKay Sievers <kay.sievers@vrfy.org>2009-10-30 12:39:04 +0100
commit26347a4c5538008318188118872490128f43fcd3 (patch)
tree1bd46e51f23a581bc4ac0faa591a58487b015bda /udev
parent82c6558e0109f66091e3a8e2c4ceef0372b0b331 (diff)
use CLOEXEC flags instead of fcntl()
Diffstat (limited to 'udev')
-rw-r--r--udev/udev-watch.c6
-rw-r--r--udev/udevd.c4
2 files changed, 3 insertions, 7 deletions
diff --git a/udev/udev-watch.c b/udev/udev-watch.c
index 102e16f81d..d67083b51b 100644
--- a/udev/udev-watch.c
+++ b/udev/udev-watch.c
@@ -38,10 +38,8 @@ static int inotify_fd = -1;
*/
int udev_watch_init(struct udev *udev)
{
- inotify_fd = inotify_init();
- if (inotify_fd >= 0)
- util_set_fd_cloexec(inotify_fd);
- else
+ inotify_fd = inotify_init1(IN_CLOEXEC);
+ if (inotify_fd < 0)
err(udev, "inotify_init failed: %m\n");
return inotify_fd;
}
diff --git a/udev/udevd.c b/udev/udevd.c
index dfdbb4c245..88e117f50a 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -223,7 +223,6 @@ static void worker_new(struct event *event)
/* allow the main daemon netlink address to send devices to the worker */
udev_monitor_allow_unicast_sender(worker_monitor, monitor);
udev_monitor_enable_receiving(worker_monitor);
- util_set_fd_cloexec(udev_monitor_get_fd(worker_monitor));
worker = calloc(1, sizeof(struct worker));
if (worker == NULL)
@@ -945,14 +944,13 @@ int main(int argc, char *argv[])
}
/* unnamed socket from workers to the main daemon */
- if (socketpair(AF_LOCAL, SOCK_DGRAM, 0, worker_watch) < 0) {
+ if (socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, worker_watch) < 0) {
fprintf(stderr, "error getting socketpair\n");
err(udev, "error getting socketpair\n");
rc = 6;
goto exit;
}
pfd[FD_WORKER].fd = worker_watch[READ_END];
- util_set_fd_cloexec(worker_watch[WRITE_END]);
rules = udev_rules_new(udev, resolve_names);
if (rules == NULL) {