Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.8.x
-
Solaris 10
Sun Studio 12.2
-
48f64fc7ae9f0e9e8ab07ab60ccd55d3b053dfab; a10768455352eb3e49b2123234cd096a032d3474
Description
QTBUG-3265 is included in 4.8 which causes compilation error on Solaris.
In qfiledialog.cpp: qt_tildeExpansion() calls system function "getpwnam_r()"
which has two definitions depending on the _POSIX_C_SOURCE version (see pwd.h):
int getpwnam_r(const char *, struct passwd *, char *, int, struct passwd **);
struct passwd *getpwnam_r(const char *, struct passwd *, char *, int);
Current version of "qt_tildeExpansion()" assumes that the first definition is always used.
But this is broken when the _POSIX_C_SOURCE is less than 199506L
Proposal is to slightly modify the code as follows:
... int err = 0; #if defined(Q_OS_SOLARIS) && defined(_POSIX_C_SOURCE - 0 >= 199506L) tmpPw = getpwnam_r(userName.toLocal8Bit().constData(), &pw, buf, bufSize); #else err = getpwnam_r(userName.toLocal8Bit().constData(), &pw, buf, bufSize, &tmpPw); #endif ...