- Set close on exec flag for device file descriptors.
- Reset signal handlers in event_cmd_exec_act(). PR: i386/35182 Submitted by: Daniel O'Connor <darius@dons.net.au>
This commit is contained in:
parent
c8567c3a77
commit
9ad4f2d067
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=116668
@ -120,6 +120,9 @@ event_cmd_exec_act(void *this)
|
|||||||
goto out;
|
goto out;
|
||||||
case 0:
|
case 0:
|
||||||
/* child process */
|
/* child process */
|
||||||
|
signal(SIGHUP, SIG_DFL);
|
||||||
|
signal(SIGCHLD, SIG_DFL);
|
||||||
|
signal(SIGTERM, SIG_DFL);
|
||||||
execl(_PATH_BSHELL, "sh", "-c", p->line, (char *)NULL);
|
execl(_PATH_BSHELL, "sh", "-c", p->line, (char *)NULL);
|
||||||
_exit(127);
|
_exit(127);
|
||||||
default:
|
default:
|
||||||
@ -691,10 +694,18 @@ main(int ac, char* av[])
|
|||||||
(void) err(1, "cannot open device file `%s'", APM_NORM_DEVICEFILE);
|
(void) err(1, "cannot open device file `%s'", APM_NORM_DEVICEFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fcntl(apmnorm_fd, F_SETFD, 1) == -1) {
|
||||||
|
(void) err(1, "cannot set close-on-exec flag for device file '%s'", APM_NORM_DEVICEFILE);
|
||||||
|
}
|
||||||
|
|
||||||
if ((apmctl_fd = open(APM_CTL_DEVICEFILE, O_RDWR)) == -1) {
|
if ((apmctl_fd = open(APM_CTL_DEVICEFILE, O_RDWR)) == -1) {
|
||||||
(void) err(1, "cannot open device file `%s'", APM_CTL_DEVICEFILE);
|
(void) err(1, "cannot open device file `%s'", APM_CTL_DEVICEFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fcntl(apmctl_fd, F_SETFD, 1) == -1) {
|
||||||
|
(void) err(1, "cannot set close-on-exec flag for device file '%s'", APM_CTL_DEVICEFILE);
|
||||||
|
}
|
||||||
|
|
||||||
restart();
|
restart();
|
||||||
write_pid();
|
write_pid();
|
||||||
event_loop();
|
event_loop();
|
||||||
|
Loading…
Reference in New Issue
Block a user