Fixed qfile unittest rename() failing as root

When run as root was able to move file to /etc directory but was
expecting a failure.

Change-Id: Ic2ac5506253f2a3395ed56e88a856542bf82ad6d
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This commit is contained in:
Kurt Korbatits 2012-02-09 10:36:08 +10:00 committed by Qt by Nokia
parent 2ba0700ebf
commit 7f403f368e

View File

@ -2349,6 +2349,13 @@ void tst_QFile::rename()
QFETCH(QString, destination);
QFETCH(bool, result);
#if defined(Q_OS_UNIX)
if (strcmp(QTest::currentDataTag(), "renamefile -> /etc/renamefile") == 0) {
if (::getuid() == 0)
QSKIP("Running this test as root doesn't make sense");
}
#endif
QFile::remove("renamedfile");
QFile f("renamefile");
f.open(QFile::WriteOnly);