From: Ramiro Polla Date: Wed, 22 Sep 2010 02:53:16 +0000 (-0300) Subject: win32: Properly check whether path is a directory X-Git-Tag: v3.2~315 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37e27eb1972a49779c5afce62bb0732a506210be;p=thirdparty%2Fccache.git win32: Properly check whether path is a directory --- diff --git a/ccache.c b/ccache.c index e9601b6fb..76c47319d 100644 --- a/ccache.c +++ b/ccache.c @@ -284,6 +284,9 @@ get_path_in_cache(const char *name, const char *suffix) static void remember_include_file(char *path, size_t path_len, struct mdfour *cpp_hash) { +#ifdef _WIN32 + DWORD attributes; +#endif struct mdfour fhash; struct stat st; char *source = NULL; @@ -306,6 +309,14 @@ remember_include_file(char *path, size_t path_len, struct mdfour *cpp_hash) goto ignore; } +#ifdef _WIN32 + /* stat fails on directories on win32 */ + attributes = GetFileAttributes(path); + if (attributes != INVALID_FILE_ATTRIBUTES && + attributes & FILE_ATTRIBUTE_DIRECTORY) + goto ignore; +#endif + if (stat(path, &st) != 0) { cc_log("Failed to stat include file %s", path); goto failure;