Subject: lib/222: stat(2) returns 0 for path=""
To: None <gnats-admin>
From: Jarle Greipsland <jarle@darling.idt.unit.no>
List: netbsd-bugs
Date: 04/09/1994 18:35:05
>Number:         222
>Category:       lib
>Synopsis:       stat(2) returns 0 for path=""
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr  9 18:35:04 1994
>Originator:     Jarle Greipsland
>Organization:
"Free Hardware Foundation, UnLtd."
>Release:        NetBSD-current
>Environment:
Intel 486DX2-66, NetBSD-current, do., 
All sources (lib and kernel) from sun-lamp April 7.
	
System: NetBSD darling.idt.unit.no 0.9a DARLING#16 i386


>Description:
stat(2) returns 0 instead of -1 when the first parameter is the empty string.  
According to the manual page stat(2) will fail (with ENOENT) if the named file 
does not exist.  I don't think "" exist.....
	
>How-To-Repeat:
#include <stdio.h>
#include <sys/stat.h>

main(int argc, char **argv)
{
	struct stat s;
	int i;
	i = stat("", &s);
	printf("stat \"\" returned %d\n", i);
}

	
>Fix:
This one is for you to fix :-)
	

					-jarle
----
"Filenames are only for people who can't remember where they put their
 files."
				-- Tarjei T. Jensen

>Audit-Trail:
>Unformatted:


------------------------------------------------------------------------------