2001-09-10 Earnie Boyd <earnie@SF.net>

* dossh: Remove inadvertantly imported file.

2001-09-10  Danny Smith  <dannysmith@users.sourceforge.net>

	* dirent.c (opendir): Use GetFileAttributes rather than stat
	to determine if input arg is dir.
This commit is contained in:
Earnie Boyd 2001-09-10 15:41:46 +00:00
parent f3acbe3e3f
commit 34ed8fcee6
2 changed files with 23 additions and 11 deletions

View File

@ -1,3 +1,12 @@
2001-09-10 Earnie Boyd <earnie@SF.net>
* dossh: Remove inadvertantly imported file.
2001-09-10 Danny Smith <dannysmith@users.sourceforge.net>
* dirent.c (opendir): Use GetFileAttributes rather than stat
to determine if input arg is dir.
2001-08-29 Danny Smith <dannysmith@users.sourceforge.net>
* include/stdarg.h (va_list): Typedef as __builtin_va_list if

View File

@ -20,10 +20,12 @@
#include <string.h>
#include <io.h>
#include <direct.h>
#include <sys/stat.h>
#include <dirent.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h> /* for GetFileAttributes */
#define SUFFIX "*"
#define SLASH "\\"
@ -37,7 +39,7 @@ DIR *
opendir (const char *szPath)
{
DIR *nd;
struct _stat statDir;
unsigned int rc;
errno = 0;
@ -54,15 +56,16 @@ opendir (const char *szPath)
}
/* Attempt to determine if the given path really is a directory. */
if (_stat (szPath, &statDir))
rc = GetFileAttributes(szPath);
if (rc == -1)
{
/* Error, stat should have set an error value. */
/* call GetLastError for more error info */
errno = ENOENT;
return (DIR *) 0;
}
if (!S_ISDIR (statDir.st_mode))
if (!(rc & FILE_ATTRIBUTE_DIRECTORY))
{
/* Error, stat reports not a directory. */
/* Error, entry exists but not a directory. */
errno = ENOTDIR;
return (DIR *) 0;
}