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>
#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