Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:55 -0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r346227 - stable/11/sbin/mount
Message-ID:  <201904151312.x3FDCtGC036507@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Apr 15 13:12:54 2019
New Revision: 346227
URL: https://svnweb.freebsd.org/changeset/base/346227

Log:
  MFC r346038:
  Exercise some care before sending SIGHUP to mountd.

Modified:
  stable/11/sbin/mount/mount.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/mount/mount.c
==============================================================================
--- stable/11/sbin/mount/mount.c	Mon Apr 15 13:11:51 2019	(r346226)
+++ stable/11/sbin/mount/mount.c	Mon Apr 15 13:12:54 2019	(r346227)
@@ -224,6 +224,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. */
@@ -234,6 +235,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?201904151312.x3FDCtGC036507>