From 90365ab5630e3747aa06b2a318b8ac39f92bc329 Mon Sep 17 00:00:00 2001 From: natano Date: Sun, 31 Jul 2016 20:13:12 +0000 Subject: Close /dev/hotplug on exec(). Otherwise a restart of the daemon may fail, because the device is occupied by a child process. from Alexey Vatchenko ok jca --- usr.sbin/hotplugd/hotplugd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.sbin/hotplugd') diff --git a/usr.sbin/hotplugd/hotplugd.c b/usr.sbin/hotplugd/hotplugd.c index 2e23bc7c19e..1b067b6ea33 100644 --- a/usr.sbin/hotplugd/hotplugd.c +++ b/usr.sbin/hotplugd/hotplugd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hotplugd.c,v 1.13 2015/11/19 06:05:40 deraadt Exp $ */ +/* $OpenBSD: hotplugd.c,v 1.14 2016/07/31 20:13:12 natano Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko * @@ -80,7 +80,7 @@ main(int argc, char *argv[]) if (argc > 0) usage(); - if ((devfd = open(device, O_RDONLY)) == -1) + if ((devfd = open(device, O_RDONLY | O_CLOEXEC)) == -1) err(1, "%s", device); bzero(&sact, sizeof(sact)); -- cgit v1.2.3-59-g8ed1b