]>
Commit | Line | Data |
---|---|---|
31a0326c AM |
1 | diff -up qt-everywhere-opensource-src-4.8.3/src/corelib/io/qfilesystemengine_unix.cpp.QTBUG-4862 qt-everywhere-opensource-src-4.8.3/src/corelib/io/qfilesystemengine_unix.cpp |
2 | --- qt-everywhere-opensource-src-4.8.3/src/corelib/io/qfilesystemengine_unix.cpp.QTBUG-4862 2012-09-10 20:36:50.000000000 -0500 | |
3 | +++ qt-everywhere-opensource-src-4.8.3/src/corelib/io/qfilesystemengine_unix.cpp 2012-10-22 14:16:42.672111081 -0500 | |
4 | @@ -611,7 +611,26 @@ bool QFileSystemEngine::setPermissions(c | |
5 | QString QFileSystemEngine::homePath() | |
6 | { | |
7 | QString home = QFile::decodeName(qgetenv("HOME")); | |
8 | - if (home.isNull()) | |
9 | + if (home.isEmpty()) | |
10 | + { | |
11 | +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) | |
12 | + int size_max = sysconf(_SC_GETPW_R_SIZE_MAX); | |
13 | + if (size_max == -1) | |
14 | + size_max = 1024; | |
15 | + QVarLengthArray<char, 1024> buf(size_max); | |
16 | +#endif | |
17 | + struct passwd *pw = 0; | |
18 | + uid_t user_id = getuid(); | |
19 | + pw = getpwuid(user_id); | |
20 | +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) | |
21 | + struct passwd entry; | |
22 | + getpwuid_r(user_id, &entry, buf.data(), buf.size(), &pw); | |
23 | +#else | |
24 | + pw = getpwuid(user_id); | |
25 | +#endif | |
26 | + home = QFile::decodeName(QByteArray(pw->pw_dir)); | |
27 | + } | |
28 | + if (home.isEmpty()) | |
29 | home = rootPath(); | |
30 | return QDir::cleanPath(home); | |
31 | } | |
32 | diff -up qt-everywhere-opensource-src-4.8.3/src/corelib/io/qfsfileengine_unix.cpp.QTBUG-4862 qt-everywhere-opensource-src-4.8.3/src/corelib/io/qfsfileengine_unix.cpp |