sysconf() system function returns long
Change-Id: Ia7218c1cc0e8ec55822aee55d7643d6df48efa8b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
7ffa0d3be5
commit
dda60cf0d1
@ -764,7 +764,7 @@ QByteArray QFileSystemEngine::id(int fd)
|
|||||||
QString QFileSystemEngine::resolveUserName(uint userId)
|
QString QFileSystemEngine::resolveUserName(uint userId)
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
|
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
|
||||||
int size_max = sysconf(_SC_GETPW_R_SIZE_MAX);
|
long size_max = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||||
if (size_max == -1)
|
if (size_max == -1)
|
||||||
size_max = 1024;
|
size_max = 1024;
|
||||||
QVarLengthArray<char, 1024> buf(size_max);
|
QVarLengthArray<char, 1024> buf(size_max);
|
||||||
@ -790,7 +790,7 @@ QString QFileSystemEngine::resolveUserName(uint userId)
|
|||||||
QString QFileSystemEngine::resolveGroupName(uint groupId)
|
QString QFileSystemEngine::resolveGroupName(uint groupId)
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
|
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
|
||||||
int size_max = sysconf(_SC_GETPW_R_SIZE_MAX);
|
long size_max = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||||
if (size_max == -1)
|
if (size_max == -1)
|
||||||
size_max = 1024;
|
size_max = 1024;
|
||||||
QVarLengthArray<char, 1024> buf(size_max);
|
QVarLengthArray<char, 1024> buf(size_max);
|
||||||
@ -806,7 +806,7 @@ QString QFileSystemEngine::resolveGroupName(uint groupId)
|
|||||||
struct group entry;
|
struct group entry;
|
||||||
// Some large systems have more members than the POSIX max size
|
// Some large systems have more members than the POSIX max size
|
||||||
// Loop over by doubling the buffer size (upper limit 250k)
|
// Loop over by doubling the buffer size (upper limit 250k)
|
||||||
for (unsigned size = size_max; size < 256000; size += size)
|
for (long size = size_max; size < 256000; size += size)
|
||||||
{
|
{
|
||||||
buf.resize(size);
|
buf.resize(size);
|
||||||
// ERANGE indicates that the buffer was too small
|
// ERANGE indicates that the buffer was too small
|
||||||
|
Loading…
x
Reference in New Issue
Block a user