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


_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to