From: natano Date: Sun, 31 Jul 2016 20:13:12 +0000 (+0000) Subject: Close /dev/hotplug on exec(). Otherwise a restart of the daemon may X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=90365ab5630e3747aa06b2a318b8ac39f92bc329;p=openbsd 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 --- 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));