]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Explicitly check return status from a call to system()
authorStephen Morris <stephen@isc.org>
Mon, 7 Jan 2013 11:06:09 +0000 (11:06 +0000)
committerStephen Morris <stephen@isc.org>
Mon, 7 Jan 2013 11:06:09 +0000 (11:06 +0000)
Using g++, on some systems a call to system() is tagged with the
"warn unused result" attribute.  As all warnings are promoted to
errors, all uses of system() must use the returned status code.

src/bin/auth/tests/query_unittest.cc

index 086b2515a61d3824141d7fcaba0b885a8c551251..a22d2d73dcf1a2b325d3d654479d5cf3f8a99efb 100644 (file)
@@ -799,11 +799,13 @@ createDataSrcClientList(DataSrcType type, DataSourceClient& client) {
         return (list);
     case SQLITE3:
         // The copy should succeed; if it failed we should notice it in
-        // test cases.
-        std::system(INSTALL_PROG " -c " TEST_OWN_DATA_BUILDDIR
-                    "/example-base.sqlite3 "
-                    TEST_OWN_DATA_BUILDDIR
-                    "/example-base.sqlite3.copied");
+        // test cases.  However, we check the return value to avoid problems
+        // in some glibcs where "system()" is annotated with the "warn unused
+        // result" attribute.
+        EXPECT_EQ(0, std::system(INSTALL_PROG " -c " TEST_OWN_DATA_BUILDDIR
+                                 "/example-base.sqlite3 "
+                                 TEST_OWN_DATA_BUILDDIR
+                                 "/example-base.sqlite3.copied"));
         list.reset(new ConfigurableClientList(RRClass::IN()));
         list->configure(isc::data::Element::fromJSON(
                             "[{\"type\": \"sqlite3\","