svn commit: r346224 - stable/12/sbin/mount

Konstantin Belousov kib at FreeBSD.org
Mon Apr 15 12:24:20 UTC 2019


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");


More information about the svn-src-stable-12 mailing list