Subject: bin/3023: cron fails with "STAT FAILED" error
To: None <gnats-bugs@gnats.netbsd.org>
From: Dave Huang <khym@bga.com>
List: netbsd-bugs
Date: 12/12/1996 02:48:42
>Number:         3023
>Category:       bin
>Synopsis:       cron fails with "STAT FAILED" error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 13 03:35:00 1996
>Last-Modified:
>Originator:     Dave Huang
>Organization:
Name: Dave Huang     |   Mammal, mammal / their names are called /
INet: khym@bga.com   |   they raise a paw / the bat, the cat /
FurryMUCK: Dahan     |   dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 21 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++
>Release:        NetBSD-current as of December 11, 1996
>Environment:
	
System: NetBSD host4.alterity.com 1.2B NetBSD 1.2B (SPIFF) #73: Sun Dec 8 18:14:57 CST 1996 khym@host4.alterity.com:/usr/src/sys/arch/i386/compile/SPIFF i386


>Description:
cron was recently changed to use daemon(), but it is called with
"nochdir" set to 0; i.e. cron will chdir to /. However, cron expects
the current directory to be /var/cron. When it goes to look for the
crontabs, it can't find them and logs "(CRON) STAT FAILED (tabs)",
then dies.

>How-To-Repeat:
Install the latest version of cron and notice that your crontabs are no
longer being executed.

>Fix:
--- /usr/src/usr.sbin/cron/cron.c	Mon Dec  9 06:23:40 1996
+++ cron.c	Thu Dec 12 02:39:16 1996
@@ -91,7 +91,7 @@
 # endif
 		(void) fprintf(stderr, "[%d] cron started\n", getpid());
 	} else {
-		if (daemon(0, 0)) {
+		if (daemon(1, 0)) {
 			log_it("CRON",getpid(),"DEATH","can't fork");
 			exit(1);
 		}

>Audit-Trail:
>Unformatted: