* apply c2aad11cc2c74aa5be540b6ac9033f3af38ea143 by by Sam Liddicott: use stat()...
authorWilfried Göesgens <willi@citadel.org>
Tue, 9 Jun 2009 19:55:54 +0000 (19:55 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 9 Jun 2009 19:55:54 +0000 (19:55 +0000)
webcit/static.c

index cca82086e318265a795337f4caf0d177250bc492..0d538f1b38070885585e015f81ae3ff2d5851720 100644 (file)
@@ -123,6 +123,16 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
 #endif
                d_without_ext = d_namelen;
 
+               if (filedir_entry->d_type == DT_UNKNOWN) {
+                       struct stat s;
+                       char path[PATH_MAX];
+                       snprintf(path, PATH_MAX, "%s/%s", 
+                               DirName, filedir_entry->d_name);
+                       if (stat(path, &s) == 0) {
+                               filedir_entry->d_type = IFTODT(s.st_mode);
+                       }
+               }
+
                if ((d_namelen > 1) && filedir_entry->d_name[d_namelen - 1] == '~')
                        continue; /* Ignore backup files... */