diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 21e2987782..9e2c69f088 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -191,11 +191,16 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry, } } # else -# if _POSIX_VERSION >= 200801L +# if (_POSIX_VERSION >= 200801L || defined(Q_OS_QNX)) ret = realpath(entry.nativeFilePath().constData(), (char*)0); # else ret = (char*)malloc(PATH_MAX); - realpath(entry.nativeFilePath().constData(), (char*)ret); + if (realpath(entry.nativeFilePath().constData(), (char*)ret) == 0) { + const int savedErrno = errno; // errno is checked below, and free() might change it + free(ret); + errno = savedErrno; + ret = 0; + } # endif # endif if (ret) { |