Index: /trunk/src/corelib/io/qfsfileengine.cpp
===================================================================
--- /trunk/src/corelib/io/qfsfileengine.cpp	(revision 611)
+++ /trunk/src/corelib/io/qfsfileengine.cpp	(revision 612)
@@ -114,7 +114,4 @@
     is_link = 0;
 #endif
-#if defined(Q_OS_OS2)
-    not_ready = 0;
-#endif
     openMode = QIODevice::NotOpen;
     fd = -1;
Index: /trunk/src/corelib/io/qfsfileengine_os2.cpp
===================================================================
--- /trunk/src/corelib/io/qfsfileengine_os2.cpp	(revision 611)
+++ /trunk/src/corelib/io/qfsfileengine_os2.cpp	(revision 612)
@@ -138,4 +138,19 @@
 }
 
+static bool isUncRootPath(const QString &path)
+{
+    QString localPath = QDir::toNativeSeparators(path);
+    if (!localPath.startsWith(QLatin1String("\\\\")))
+        return false;
+
+    int idx = localPath.indexOf(QLatin1Char('\\'), 2);
+    if (idx == -1 || idx + 1 == localPath.length())
+        return true;
+
+    localPath = localPath.right(localPath.length() - idx - 1).trimmed();
+    return localPath.isEmpty();
+}
+
+
 static bool isRelativePath(const QString &path)
 {
@@ -642,5 +657,4 @@
                 // ready: an attempt to stat() on a removable drive with no
                 // media inserted will cause an unnecessary delay and noise.
-                not_ready = 0;
                 BYTE drv[3] = { filePath.at(0).cell(), ':', '\0' };
                 BYTE buf[sizeof(FSQBUFFER2) + (3 * CCHMAXPATH)] = {0};
@@ -649,11 +663,5 @@
                 APIRET arc = DosQueryFSAttach(drv, 0, FSAIL_QUERYNAME, pfsq,
                                               &bufSize);
-                if (arc == ERROR_NOT_READY) {
-                    // it must be a removable drive with no media in it
-                    memset(&st, 0, sizeof(st));
-                    st.st_mode = S_IFDIR | 0777;
-                    not_ready = 1;
-                    could_stat = true;
-                } else if (arc != NO_ERROR) {
+                if (arc != NO_ERROR) {
                     could_stat = false;
                 } else {
@@ -676,6 +684,11 @@
         QFSFileEnginePrivate *that = const_cast<QFSFileEnginePrivate *>(this);
         that->need_lstat = false;
-        QT_STATBUF st;          // don't clobber our main one
-        that->is_link = (QT_LSTAT(nativeFilePath.constData(), &st) == 0) ? S_ISLNK(st.st_mode) : false;
+        if (isDriveRootPath(filePath) || isUncRootPath(filePath)) {
+            is_link = false;        // drive/share names are never symlinks
+        } else {
+            QT_STATBUF st;          // don't clobber our main one
+            that->is_link = (QT_LSTAT(nativeFilePath.constData(), &st) == 0) ?
+                            S_ISLNK(st.st_mode) : false;
+        }
     }
     return is_link;
@@ -688,16 +701,35 @@
 {
     Q_D(const QFSFileEngine);
+
     // Force a stat, so that we're guaranteed to get up-to-date results
-    if (type & QAbstractFileEngine::FileFlag(QAbstractFileEngine::Refresh)) {
+    if (type & Refresh) {
         d->tried_stat = 0;
         d->need_lstat = 1;
     }
 
+    bool isRoot = isDriveRootPath(d->filePath) || isUncRootPath(d->filePath);
+    bool exists = d->doStat();
+
     QAbstractFileEngine::FileFlags ret = 0;
-    bool exists = d->doStat();
-    if (!exists && !d->isSymlink())
+
+    // flags that don't need doStat()
+    if (type & FlagsMask) {
+        ret |= LocalDiskFlag;
+        if (isRoot)
+            ret |= RootFlag;
+    }
+    if (type & TypesMask) {
+        if (isRoot)
+            ret |= DirectoryType;
+        // note: drive/share names are never symlinks
+        else if ((type & LinkType) && d->isSymlink())
+            ret |= LinkType;
+    }
+
+    if (!exists)
         return ret;
 
-    if (exists && (type & PermsMask)) {
+    // flags that need doStat()
+    if (type & PermsMask) {
         if (d->st.st_mode & S_IRUSR)
             ret |= ReadOwnerPerm;
@@ -726,22 +758,15 @@
     }
     if (type & TypesMask) {
-        {
-            if ((type & LinkType) && d->isSymlink())
-                ret |= LinkType;
-            if (exists && (d->st.st_mode & S_IFMT) == S_IFREG)
-                ret |= FileType;
-            else if (exists && (d->st.st_mode & S_IFMT) == S_IFDIR)
-                ret |= DirectoryType;
-        }
+        if ((d->st.st_mode & S_IFMT) == S_IFREG)
+            ret |= FileType;
+        else if ((d->st.st_mode & S_IFMT) == S_IFDIR)
+            ret |= DirectoryType;
     }
     if (type & FlagsMask) {
-        ret |= LocalDiskFlag;
-        if (exists)
-            ret |= ExistsFlag;
+        ret |= ExistsFlag;
         if (d->st.st_attr & FILE_HIDDEN)
             ret |= HiddenFlag;
-        if (isDriveRootPath(d->filePath))
-            ret |= RootFlag;
-    }
+    }
+
     return ret;
 }
@@ -1002,5 +1027,5 @@
     Q_D(const QFSFileEngine);
     QDateTime ret;
-    if (d->doStat() && !d->not_ready) {
+    if (d->doStat()) {
         if (time == CreationTime)
             ret.setTime_t(d->st.st_ctime ? d->st.st_ctime : d->st.st_mtime);
Index: /trunk/src/corelib/io/qfsfileengine_p.h
===================================================================
--- /trunk/src/corelib/io/qfsfileengine_p.h	(revision 611)
+++ /trunk/src/corelib/io/qfsfileengine_p.h	(revision 612)
@@ -138,7 +138,4 @@
     mutable uint is_link : 1;
 #endif
-#if defined(Q_OS_OS2)
-    mutable uint not_ready : 1;
-#endif
 
     bool doStat() const;
