Bug 29167

Summary: rc.pccard doesn't check /var/run/pccardd.pid
Product: Base System Reporter: Jeremiah Gowdy <jgowdy>
Component: confAssignee: Warner Losh <imp>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.3-STABLE   
Hardware: Any   
OS: Any   

Description Jeremiah Gowdy 2001-07-23 18:00:03 UTC
rc.pccard doesn't check /var/run/pccardd.pid to see if pccardd is already running, and therefore if you modify configuration and /etc/netstart, you get a defunct copy of pccardd in addition to the one that was already running.  This patch to rc.pccard simply checks for the existence of the .pid file, and if it exists, checks to see if the process is actually running, or if the pid file is just a leftover.  In either case, it starts pccardd as usual, but does not start two pccardds.

Fix: 

rc.pccard.diff

34,41d33
<       if [ -e /var/run/pccardd.pid ] ; then 
<               pid=`cat /var/run/pccardd.pid`
<               psline=`ps -p $pid | grep -v PID`
<               if [ ! -n "$psline" ] ; then
<                       rm /var/run/pccardd.pid
<               fi
<       fi
<       if [ ! -e /var/run/pccardd.pid ] ; then
63d54
<       fi
How-To-Repeat: run /etc/netstart twice (or more) with pccard enabled in rc.conf
Comment 1 jeremiah 2001-07-25 19:13:16 UTC
Actually, this might be a little cleaner

33a34,37
>       if [ -e /var/run/pccardd.pid ] ; then
>               process="/proc/`cat /var/run/pccardd.pid`"
>       fi
>       if [ ! -e $process ] ; then
54a59
>       fi

Jeremiah
Comment 2 Kris Kennaway freebsd_committer freebsd_triage 2003-07-13 00:54:00 UTC
Responsible Changed
From-To: freebsd-bugs->imp

Assign to pccard maintainer
Comment 3 Warner Losh freebsd_committer freebsd_triage 2004-06-29 16:15:35 UTC
State Changed
From-To: open->closed

pccardd now appears to exit on running the second time.   Please let 
me know if this isn't fixed in 4.10.