summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2011-02-06 17:51:34 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2011-02-08 11:54:27 (GMT)
commit8d6ad569495d389b111ab8879117cc7832287fa8 (patch)
treedf508b392dbde31ef3dff13601cef825a7700164 /src/gui
parentc718d992865de7015df0173c816b257d72e13f24 (diff)
downloadQt-8d6ad569495d389b111ab8879117cc7832287fa8.zip
Qt-8d6ad569495d389b111ab8879117cc7832287fa8.tar.gz
Qt-8d6ad569495d389b111ab8879117cc7832287fa8.tar.bz2
Make sure we use at least 1024 bytes when calling getpwuid_r.
On some systems, sysconf may return -1 to indicate that there's no such limit (limitless), so don't create a buffer of size -1. Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qapplication_x11.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index f28868c..8fef6fb 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -5657,7 +5657,7 @@ static void sm_performSaveYourself(QSessionManagerPrivate* smd)
// tell the session manager about our user as well.
struct passwd *entryPtr = 0;
#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
- QVarLengthArray<char, 1024> buf(sysconf(_SC_GETPW_R_SIZE_MAX));
+ QVarLengthArray<char, 1024> buf(qMax<long>(sysconf(_SC_GETPW_R_SIZE_MAX), 1024L));
struct passwd entry;
getpwuid_r(geteuid(), &entry, buf.data(), buf.size(), &entryPtr);
#else