Blame SOURCES/qt-everywhere-opensource-src-4.8.5-QTBUG-4862.patch

2060a3
diff -up qt-everywhere-opensource-src-4.8.5/src/corelib/io/qfilesystemengine_unix.cpp.QTBUG-4862 qt-everywhere-opensource-src-4.8.5/src/corelib/io/qfilesystemengine_unix.cpp
2060a3
--- qt-everywhere-opensource-src-4.8.5/src/corelib/io/qfilesystemengine_unix.cpp.QTBUG-4862	2013-06-09 12:02:50.323221694 -0500
2060a3
+++ qt-everywhere-opensource-src-4.8.5/src/corelib/io/qfilesystemengine_unix.cpp	2013-06-09 12:38:53.140804742 -0500
2060a3
@@ -624,6 +624,25 @@ QString QFileSystemEngine::homePath()
2060a3
 {
2060a3
     QString home = QFile::decodeName(qgetenv("HOME"));
2060a3
     if (home.isEmpty())
2060a3
+    {
2060a3
+#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
2060a3
+        int size_max = sysconf(_SC_GETPW_R_SIZE_MAX);
2060a3
+        if (size_max == -1)
2060a3
+            size_max = 1024;
2060a3
+        QVarLengthArray<char, 1024> buf(size_max);
2060a3
+#endif
2060a3
+        struct passwd *pw = 0;
2060a3
+        uid_t user_id = getuid();
2060a3
+        pw = getpwuid(user_id);
2060a3
+#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
2060a3
+        struct passwd entry;
2060a3
+        getpwuid_r(user_id, &entry, buf.data(), buf.size(), &pw;;
2060a3
+#else
2060a3
+        pw = getpwuid(user_id);
2060a3
+#endif
2060a3
+        home = QFile::decodeName(QByteArray(pw->pw_dir));
2060a3
+    }
2060a3
+    if (home.isEmpty())
2060a3
         home = rootPath();
2060a3
     return QDir::cleanPath(home);
2060a3
 }