Exercise some care before sending SIGHUP to mountd.
Reviewed by: antoine, emaste, oshogbo Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D19847
This commit is contained in:
parent
5ffc99e2e4
commit
7bead17ddc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346038
@ -227,6 +227,7 @@ restart_mountd(void)
|
|||||||
struct pidfh *pfh;
|
struct pidfh *pfh;
|
||||||
pid_t mountdpid;
|
pid_t mountdpid;
|
||||||
|
|
||||||
|
mountdpid = 0;
|
||||||
pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &mountdpid);
|
pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &mountdpid);
|
||||||
if (pfh != NULL) {
|
if (pfh != NULL) {
|
||||||
/* Mountd is not running. */
|
/* Mountd is not running. */
|
||||||
@ -237,6 +238,16 @@ restart_mountd(void)
|
|||||||
/* Cannot open pidfile for some reason. */
|
/* Cannot open pidfile for some reason. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Refuse to send broadcast or group signals, this has
|
||||||
|
* happened due to the bugs in pidfile(3).
|
||||||
|
*/
|
||||||
|
if (mountdpid <= 0) {
|
||||||
|
warnx("mountd pid %d, refusing to send SIGHUP", mountdpid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* We have mountd(8) PID in mountdpid varible, let's signal it. */
|
/* We have mountd(8) PID in mountdpid varible, let's signal it. */
|
||||||
if (kill(mountdpid, SIGHUP) == -1)
|
if (kill(mountdpid, SIGHUP) == -1)
|
||||||
err(1, "signal mountd");
|
err(1, "signal mountd");
|
||||||
|
Loading…
Reference in New Issue
Block a user