diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2012-02-08 15:03:34 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-09 10:47:33 +0100 |
commit | 5cd73e508886c38ce52e883294484f1ab58a519e (patch) | |
tree | e24d690a82787996d5420258629a664bf5f89705 /tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | |
parent | 3e720809b0313ba1d3e51e29e951604971946935 (diff) |
Fixed tst_qfileinfo::group crash if getgrgid fails
QVERIFY2 and gracefully fail with an error message, rather than
crashing, if getgrgid() fails.
Change-Id: I82a7290f83208486577988cc831d5d3cba20f98e
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Diffstat (limited to 'tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp')
-rw-r--r-- | tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 7b80152b62..a3d80cb66f 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1722,7 +1722,13 @@ void tst_QFileInfo::group() #if defined(Q_OS_UNIX) struct group *gr; gid_t gid = getegid(); + + errno = 0; gr = getgrgid(gid); + + QVERIFY2(gr, qPrintable( + QString("getgrgid returned 0: %1, cannot determine my own group") + .arg(QString::fromLocal8Bit(strerror(errno))))); expected = QString::fromLocal8Bit(gr->gr_name); #endif |