]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
win32: Properly check whether path is a directory
authorRamiro Polla <ramiro.polla@gmail.com>
Wed, 22 Sep 2010 02:53:16 +0000 (23:53 -0300)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 26 Sep 2010 20:12:35 +0000 (22:12 +0200)
ccache.c

index e9601b6fb22d199cfa0a05fe58c20d5fa45edb8c..76c47319d7c26e5b656fd6c5beb89d25f31d90d6 100644 (file)
--- 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;