[Scummvm-cvs-logs] SF.net SVN: scummvm: [21767] scummvm/trunk/backends/fs/posix/posix-fs.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Apr 10 12:27:05 CEST 2006


Revision: 21767
Author:   fingolfin
Date:     2006-04-10 12:26:40 -0700 (Mon, 10 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21767&view=rev

Log Message:
-----------
Fallback to using stat() if readdir returns DT_UNKNOWN (replacing the AMD64 hack)

Modified Paths:
--------------
    scummvm/trunk/backends/fs/posix/posix-fs.cpp
Modified: scummvm/trunk/backends/fs/posix/posix-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/posix/posix-fs.cpp	2006-04-10 17:32:04 UTC (rev 21766)
+++ scummvm/trunk/backends/fs/posix/posix-fs.cpp	2006-04-10 19:26:40 UTC (rev 21767)
@@ -137,12 +137,7 @@
 
 #ifdef __DC__
 		entry._isDirectory = dp->d_size < 0;
-#elif defined(SYSTEM_NOT_SUPPORTING_D_TYPE) || defined(__x86_64__)
-		// HACK: on debian/unstable (and gentoo it seems) running on amd64 the d_type field
-		// is always 0/DT_UNKNOWN so use this also on amd64 systems maybe check this in
-		// the configure script when running on an amd64 instead of forcing it for all amd64
-		// systems. It seems to work on Fedora though.
-
+#elif defined(SYSTEM_NOT_SUPPORTING_D_TYPE)
 		// TODO: d_type is not part of POSIX, so it might not be supported
 		// on some of our targets. For those systems where it isn't supported,
 		// add this #elif case, which tries to use stat() instead.
@@ -150,13 +145,20 @@
 		entry._isValid = (0 == stat(entry._path.c_str(), &st));
 		entry._isDirectory = S_ISDIR(st.st_mode);
 #else
-		entry._isValid = (dp->d_type == DT_DIR) || (dp->d_type == DT_REG) || (dp->d_type == DT_LNK);
-		if (dp->d_type == DT_LNK) {
+		if (dp->d_type == DT_UNKNOWN) {
+			// Fall back to stat()
 			struct stat st;
-			stat(entry._path.c_str(), &st);
+			entry._isValid = (0 == stat(entry._path.c_str(), &st));
 			entry._isDirectory = S_ISDIR(st.st_mode);
 		} else {
-			entry._isDirectory = (dp->d_type == DT_DIR);
+			entry._isValid = (dp->d_type == DT_DIR) || (dp->d_type == DT_REG) || (dp->d_type == DT_LNK);
+			if (dp->d_type == DT_LNK) {
+				struct stat st;
+				stat(entry._path.c_str(), &st);
+				entry._isDirectory = S_ISDIR(st.st_mode);
+			} else {
+				entry._isDirectory = (dp->d_type == DT_DIR);
+			}
 		}
 #endif
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list