fix a test program bug 34/240034/1
authorYoungjae Shin <yj99.shin@samsung.com>
Mon, 3 Aug 2020 00:10:38 +0000 (09:10 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Mon, 3 Aug 2020 00:10:38 +0000 (09:10 +0900)
Change-Id: I8dc576511b72772ee5155ef62efb2a37abbac845

tests/db-util-gtest.cpp

index 51abd5d..dd20e8b 100644 (file)
@@ -151,13 +151,15 @@ TEST_F(DbUtil, db_util_open_n4)
        chmod("test.db", 0000);
 
        uid_t uid = geteuid();
-       if (seteuid(1000) < 0)
-               FAIL() << "errno = " << errno << std::endl;
+       if (geteuid() == 0)
+               if (seteuid(1000) < 0)
+                       FAIL() << "errno = " << errno << std::endl;
 
        rc = db_util_open(pszFilePath, &db, nOption);
 
-       if (seteuid(uid) < 0)
+       if (uid == 0 && seteuid(uid) < 0)
                FAIL() << "errno = " << errno << std::endl;
+
        ASSERT_EQ(SQLITE_PERM, rc);
 }