Use lstat() instead of access() for checking file existence. It works

for symlinks too, and according to Rod, access() is evil anyway.

Reviewed by:	jkh
This commit is contained in:
Satoshi Asami 1995-06-24 10:12:59 +00:00
parent f606c848fa
commit 575e2e187e

View File

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: file.c,v 1.9 1995/05/10 23:00:16 jkh Exp $";
static const char *rcsid = "$Id: file.c,v 1.10 1995/05/30 03:50:05 rgrimes Exp $";
#endif
/*
@ -30,7 +30,8 @@ static const char *rcsid = "$Id: file.c,v 1.9 1995/05/10 23:00:16 jkh Exp $";
Boolean
fexists(char *fname)
{
if (!access(fname, F_OK))
struct stat dummy;
if (!lstat(fname, &dummy))
return TRUE;
return FALSE;
}