]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ICC: support 64-bit environments dirent definitions
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 7 Apr 2011 11:58:46 +0000 (23:58 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 7 Apr 2011 11:58:46 +0000 (23:58 +1200)
struct dirent is not consistently defined for 32-bit and 64-bit enabled
environments. Provide a dirent_t type defined appropriate to the environment
for use instead.

compat/compat_shared.h
src/fs/ufs/store_dir_ufs.cc
src/fs/ufs/ufscommon.h

index 1d2b89390f942537b4e8e893926d977fdfbd7354..7c09843a269cc61fe71c54209075ed7dc876c705 100644 (file)
@@ -34,8 +34,7 @@ extern void (*failure_notify) (const char *);
 
 /*
  * DIRENT functionality can apparently come from many places.
- * I believe these should really be done by OS-specific compat
- * files, but for now its left here.
+ * With various complaints by different compilers
  */
 #if HAVE_DIRENT_H
 #include <dirent.h>
@@ -54,6 +53,15 @@ extern void (*failure_notify) (const char *);
 #endif /* HAVE_NDIR_H */
 #endif /* HAVE_DIRENT_H */
 
+/* The structure dirent also varies between 64-bit and 32-bit environments.
+ * Define our own dirent_t type for consistent simple internal use.
+ */
+#if defined(__USE_FILE_OFFSET64)
+typedef struct dirent64 dirent_t;
+#else
+typedef struct dirent dirent_t;
+#endif
+
 
 /*
  * Filedescriptor limits in the different select loops
index 09101df3f95d822aaad0262611bd87a54b6b7ab2..cd706d7fdf353b14adaa11c21fab3a4551f8b8cd 100644 (file)
@@ -1063,7 +1063,6 @@ UFSSwapDir::DirClean(int swap_index)
 {
     DIR *dir_pointer = NULL;
 
-    struct dirent *de = NULL;
     LOCAL_ARRAY(char, p1, MAXPATHLEN + 1);
     LOCAL_ARRAY(char, p2, MAXPATHLEN + 1);
 
@@ -1107,6 +1106,7 @@ UFSSwapDir::DirClean(int swap_index)
         return 0;
     }
 
+    dirent_t *de;
     while ((de = readdir(dir_pointer)) != NULL && k < 20) {
         if (sscanf(de->d_name, "%X", &swapfileno) != 1)
             continue;
index bd3588c52d97bbf6d1370ce99b3888348c9166c0..4b58916fa281837b4874b3bd7d5d5ee13d568de2 100644 (file)
@@ -399,7 +399,7 @@ public:
     int done;
     int fn;
 
-    struct dirent *entry;
+    dirent_t *entry;
     DIR *td;
     char fullpath[MAXPATHLEN];
     char fullfilename[MAXPATHLEN];