Subject: What should stat("",&fs) return?
To: None <current-users@NetBSD.ORG>
From: John Birrell <cimaxp1!jb@melb.werple.net.au>
List: current-users
Date: 05/30/1996 17:34:33
G'day,
I just came across some code that (because of another bug) tries
to stat() a null string. And NetBSD (i386 and alpha) returns zero
from this test:
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
int main()
{
struct stat fs;
if (stat("",&fs) == 0)
{
printf("Bloody hell!\n");
}
else
{
printf("Phew errno = %d\n",errno);
}
}
OSF/1 and HPUX return -1 with errno = ENOENT. I would have expected
NetBSD to behave the same way. Am I missing something?
Regards,
--
John Birrell CIMlogic Pty Ltd
jb@cimlogic.com.au 119 Cecil Street
Ph +61 3 9690 6900 South Melbourne Vic 3205
Fax +61 3 9690 6650 Australia
Mob +61 18 353 137