NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/50125: Incorrect PID in /var/run/mountd.pid



>Number:         50125
>Category:       bin
>Synopsis:       Incorrect PID in /var/run/mountd.pid
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 05 07:55:00 +0000 2015
>Originator:     Jarle Greipsland
>Release:        NetBSD 7.99.18
>Organization:
	
>Environment:
	
	
System: NetBSD singsaker.uninett.no 7.99.18 NetBSD 7.99.18 (SINGSAKER) #0: Thu Jun 4 14:37:01 CEST 2015 jarle%singsaker.uninett.no@localhost:/usr/obj/sys/arch/i386/compile/SINGSAKER i386
Architecture: i386
Machine: i386
>Description:
The PID recorded in /var/run/mountd.pid when mountd is started is not the
correct one.  A bug seems to have been introduced (-r1.126) when the

      if (debug == 0) {
              daemon(0, 0);
              (void)signal(SIGINT, SIG_IGN);
              (void)signal(SIGQUIT, SIG_IGN);
      }

statements were moved further down in the main() function, so as to appear
_after_ the call to the pidfile() function.  Since the daemon() function uses
fork() in order to detach itself from its parent, the PID recorded in
/var/run/mountd.pid will be that of the mountd program prior to the fork.
And not the PID that the mountd program will use during normal operations.

>How-To-Repeat:
Start mountd.  Try to do 'kill -HUP `cat /var/run/mountd.pid`'.

	
>Fix:
Move the call to pidfile() to someplace after the daemon() call.


	

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index