On Mon, Jul 25, 2016 at 02:17:11PM +0300, Alexey Vatchenko wrote:
> Hi!
> If something is running which is started from attach script, restarting of
> hotplugd fails because /dev/hotplug is occupied by child process.
> 
> Attached is the patch to fix this problem.

Makes sense, but why not pass O_CLOEXEC to open() instead of using
fcntl()?


> Index: usr.sbin/hotplugd/hotplugd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/hotplugd/hotplugd.c,v
> retrieving revision 1.13
> diff -u -p -r1.13 hotplugd.c
> --- usr.sbin/hotplugd/hotplugd.c      19 Nov 2015 06:05:40 -0000      1.13
> +++ usr.sbin/hotplugd/hotplugd.c      25 Jul 2016 11:05:12 -0000
> @@ -82,6 +82,7 @@ main(int argc, char *argv[])
>  
>       if ((devfd = open(device, O_RDONLY)) == -1)
>               err(1, "%s", device);
> +     fcntl(devfd, F_SETFD, FD_CLOEXEC);
>  
>       bzero(&sact, sizeof(sact));
>       sigemptyset(&sact.sa_mask);

Reply via email to