Date: Mon, 15 Apr 2019 12:24:19 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r346224 - stable/12/sbin/mount Message-ID: <201904151224.x3FCOJRw010124@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Apr 15 12:24:19 2019 New Revision: 346224 URL: https://svnweb.freebsd.org/changeset/base/346224 Log: MFC r346038: Exercise some care before sending SIGHUP to mountd. Modified: stable/12/sbin/mount/mount.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/mount/mount.c ============================================================================== --- stable/12/sbin/mount/mount.c Mon Apr 15 12:23:33 2019 (r346223) +++ stable/12/sbin/mount/mount.c Mon Apr 15 12:24:19 2019 (r346224) @@ -227,6 +227,7 @@ restart_mountd(void) struct pidfh *pfh; pid_t mountdpid; + mountdpid = 0; pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &mountdpid); if (pfh != NULL) { /* Mountd is not running. */ @@ -237,6 +238,16 @@ restart_mountd(void) /* Cannot open pidfile for some reason. */ 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. */ if (kill(mountdpid, SIGHUP) == -1) err(1, "signal mountd");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904151224.x3FCOJRw010124>