diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 4e7824522c..1c99f07400 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -1062,11 +1062,13 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM if (ok) { data.fillFromFindData(findData, false, fname.isDriveRoot()); } else { - if (!tryFindFallback(fname, data)) - if (!tryDriveUNCFallback(fname, data)) { - SetErrorMode(oldmode); - return false; - } + const DWORD lastError = GetLastError(); + if (lastError == ERROR_LOGON_FAILURE || lastError == ERROR_BAD_NETPATH // disconnected drive + || (!tryFindFallback(fname, data) && !tryDriveUNCFallback(fname, data))) { + data.clearFlags(); + SetErrorMode(oldmode); + return false; + } } SetErrorMode(oldmode); }