Subject: bin/2388: pppd tries to unlink bad file name ("")
To: None <gnats-bugs@NetBSD.ORG>
From: Michael Eriksson T/N <Michael.Eriksson@era-t.ericsson.se>
List: netbsd-bugs
Date: 05/10/1996 16:14:55
>Number:         2388
>Category:       bin
>Synopsis:       pppd tries to unlink bad file name ("")
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 10 10:35:04 1996
>Last-Modified:
>Originator:     Michael Eriksson
>Organization:
Ericsson Radio Systems AB
>Release:        NetBSD-current 960413
>Environment:
System: NetBSD abro 1.1B NetBSD 1.1B (ABRO) #0: Wed Apr 17 13:28:58 MET DST 1996 eramer@abro:/usr/src/sys/arch/sparc/compile/ABRO sparc

>Description:

If the connect script fails, pppd tries to remove the pid file, but it
hasn't set up the filename string yet. From my log file:

May 10 15:50:07 maverick pppd[12258]: Connect script failed
May 10 15:50:08 maverick pppd[12258]: unable to delete pid file: Is a directory
May 10 15:50:08 maverick pppd[12258]: Exit.

pppd is (wrongly) using "", i.e. the current directory, as argument to
unlink(2).

>How-To-Repeat:

shell>pppd connect false

>Fix:

*** usr.sbin/pppd/main.c.orig	Fri Mar 22 13:32:20 1996
--- usr.sbin/pppd/main.c	Fri May 10 15:46:14 1996
***************
*** 503,509 ****
  	}
  
  	if (!demand) {
! 	    if (unlink(pidfilename) < 0 && errno != ENOENT) 
  		syslog(LOG_WARNING, "unable to delete pid file: %m");
  	    pidfilename[0] = 0;
  	}
--- 503,510 ----
  	}
  
  	if (!demand) {
! 	    if (pidfilename[0] != 0 &&
! 		unlink(pidfilename) < 0 && errno != ENOENT) 
  		syslog(LOG_WARNING, "unable to delete pid file: %m");
  	    pidfilename[0] = 0;
  	}
>Audit-Trail:
>Unformatted: