Use lstat() rather than stat in determining whether a file exists,
otherwise we'll miss the "symlink exists but points nowhere" case. Submitted by: asami and/or possibly <ru@ucb.crimea.ua>
This commit is contained in:
parent
dc16edc804
commit
1fb230d42c
@ -1,6 +1,6 @@
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: file.c,v 1.31 1998/09/08 10:42:26 jkh Exp $";
|
||||
"$Id: file.c,v 1.32 1998/09/11 07:26:58 jkh Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -47,7 +47,7 @@ isdir(char *fname)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
if (stat(fname, &sb) != FAIL && S_ISDIR(sb.st_mode))
|
||||
if (lstat(fname, &sb) != FAIL && S_ISDIR(sb.st_mode))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user