bin/54113: [PATCH] devd(8) doesn't write correct pid into /var/run/devd.pid

Lukas Ertl l.ertl at univie.ac.at
Fri Jul 4 14:00:29 PDT 2003


>Number:         54113
>Category:       bin
>Synopsis:       [PATCH] devd(8) doesn't write correct pid into /var/run/devd.pid
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 04 14:00:27 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Lukas Ertl
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Vienna University Computer Center
>Environment:
System: FreeBSD korben 5.1-CURRENT FreeBSD 5.1-CURRENT #20: Fri Jul 4 18:38:33 CEST 2003 le at korben:/usr/obj/usr/src/sys/KORBEN i386


	
>Description:

devd(8) writes its pid into /var/run/devd.pid, but the pid there is 1 
lower than the actual pid of devd. This is because devd is started by
default without the -n switch, so it writes the pidfile before calling
daemon(8).

>How-To-Repeat:

# devd
# cat /var/run/devd.pid
720
# ps auxww | grep devd
root    721  0,0  0,2   772  532  ??  Is   10:22pm   0:00,00 devd

>Fix:

Simply write the pidfile again after calling daemon(3).

--- devd.diff begins here ---
Index: sbin/devd/devd.cc
===================================================================
RCS file: /usr/local/bsdcvs/src/sbin/devd/devd.cc,v
retrieving revision 1.14
diff -u -r1.14 devd.cc
--- sbin/devd/devd.cc	2 May 2003 17:38:08 -0000	1.14
+++ sbin/devd/devd.cc	4 Jul 2003 20:42:21 -0000
@@ -596,6 +596,7 @@
 				if (Dflag)
 					fprintf(stderr, "Calling daemon\n");
 				daemon(0, 0);
+				cfg.drop_pidfile();
 				once++;
 			}
 		}
--- devd.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list