]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3841] replaced unlink by remove
authorFrancis Dupont <fdupont@isc.org>
Tue, 12 May 2015 20:51:43 +0000 (22:51 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 12 May 2015 20:51:43 +0000 (22:51 +0200)
16 files changed:
src/bin/d2/tests/d_test_stubs.h
src/bin/dhcp4/tests/config_parser_unittest.cc
src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
src/bin/dhcp4/tests/kea_controller_unittest.cc
src/bin/dhcp6/tests/config_parser_unittest.cc
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
src/bin/dhcp6/tests/dhcp6_test_utils.h
src/bin/dhcp6/tests/kea_controller_unittest.cc
src/lib/cc/tests/data_file_unittests.cc
src/lib/cc/tests/session_unittests.cc
src/lib/dhcp/tests/iface_mgr_unittest.cc
src/lib/hooks/tests/library_manager_unittest.cc
src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc
src/lib/log/tests/logger_manager_unittest.cc
src/lib/util/tests/socketsession_unittest.cc

index 23d4efcd29f2358da40d98fa212999f5b7191768..c0ec58c75b2538404ad2894e112a1dd0ea67e8ba 100644 (file)
@@ -359,7 +359,7 @@ public:
         }
 
         getController().reset();
-        static_cast<void>(unlink(CFG_TEST_FILE));
+        static_cast<void>(remove(CFG_TEST_FILE));
     }
 
     /// @brief Convenience method that destructs and then recreates the
index 7cb289ca06d2fd36978b81a7bb0fa59f36c50fe2..097ef69b35abcd8e6d86398b338b414773430731 100644 (file)
@@ -122,8 +122,8 @@ public:
         resetConfiguration();
 
         // ... and delete the hooks library marker files if present
-        unlink(LOAD_MARKER_FILE);
-        unlink(UNLOAD_MARKER_FILE);
+        remove(LOAD_MARKER_FILE);
+        remove(UNLOAD_MARKER_FILE);
     };
 
     /// @brief Returns an interface configuration used by the most of the
index 5f111b4fb9786c70e855d66f1994f5f58d430c3c..8389cdfe866475fa0c70619135e3a6d5075eb6ab 100644 (file)
@@ -68,8 +68,8 @@ public:
         HooksManager::unloadLibraries();
 
         // Get rid of any marker files.
-        static_cast<void>(unlink(LOAD_MARKER_FILE));
-        static_cast<void>(unlink(UNLOAD_MARKER_FILE));
+        static_cast<void>(remove(LOAD_MARKER_FILE));
+        static_cast<void>(remove(UNLOAD_MARKER_FILE));
     }
 };
 
index d98621ed0e962a261cd4df56a018c351a218a4d9..fc974bb626cf7e93bed5737133845e3b70ab84bd 100644 (file)
@@ -59,7 +59,7 @@ public:
 
     ~JSONFileBackendTest() {
         isc::log::setDefaultLoggingOutput();
-        static_cast<void>(unlink(TEST_FILE));
+        static_cast<void>(remove(TEST_FILE));
     };
 
     /// @brief writes specified content to a well known file
@@ -69,7 +69,7 @@ public:
     ///
     /// @param content content to be written to file
     void writeFile(const std::string& content) {
-        static_cast<void>(unlink(TEST_FILE));
+        static_cast<void>(remove(TEST_FILE));
 
         ofstream out(TEST_FILE, ios::trunc);
         EXPECT_TRUE(out.is_open());
index f843b160ea3f2b5461c6fbd8de647cd05bd44f49..89d7e493a0640d27d304ab0a9a58ba6284a603f4 100644 (file)
@@ -114,8 +114,8 @@ public:
         resetConfiguration();
 
         // ... and delete the hooks library marker files if present
-        unlink(LOAD_MARKER_FILE);
-        unlink(UNLOAD_MARKER_FILE);
+        remove(LOAD_MARKER_FILE);
+        remove(UNLOAD_MARKER_FILE);
     };
 
     // Checks if config_result (result of DHCP server configuration) has
index 110adc8fbb99052dfa9f21ab5adff85bff290c11..3734d1ad94813a230274c6f8d99bc255ad867022 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2013,2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2013, 2015 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -58,8 +58,8 @@ public:
         HooksManager::unloadLibraries();
 
         // Get rid of any marker files.
-        static_cast<void>(unlink(LOAD_MARKER_FILE));
-        static_cast<void>(unlink(UNLOAD_MARKER_FILE));
+        static_cast<void>(remove(LOAD_MARKER_FILE));
+        static_cast<void>(remove(UNLOAD_MARKER_FILE));
     }
 };
 
index 8548d9947da655075a656a6904b46a8f68387e82..ca17594ba85ab0cba9c19e5d969b35285f371351 100644 (file)
@@ -1445,7 +1445,7 @@ TEST_F(Dhcpv6SrvTest, ServerID) {
     ASSERT_TRUE(expected_duid1 == srv.getServerID()->getData());
 
     // Now test writing to a file
-    EXPECT_EQ(0, unlink(DUID_FILE));
+    EXPECT_EQ(0, remove(DUID_FILE));
     EXPECT_NO_THROW(srv.writeServerID(DUID_FILE));
 
     fstream file2(DUID_FILE, ios::in);
index 499ebdea323d5a50f83386a401f0bf50177b5534..de8a51c33032b99a721cbbcc2a16992eac0e5441 100644 (file)
@@ -136,7 +136,7 @@ public:
 
     NakedDhcpv6SrvTest() : rcode_(-1) {
         // it's ok if that fails. There should not be such a file anyway
-        unlink(DUID_FILE);
+        remove(DUID_FILE);
 
         const isc::dhcp::IfaceMgr::IfaceCollection& ifaces =
             isc::dhcp::IfaceMgr::instance().getIfaces();
@@ -288,7 +288,7 @@ public:
 
     virtual ~NakedDhcpv6SrvTest() {
         // Let's clean up if there is such a file.
-        unlink(DUID_FILE);
+        remove(DUID_FILE);
         isc::hooks::HooksManager::preCalloutsLibraryHandle()
             .deregisterAllCallouts("buffer6_receive");
         isc::hooks::HooksManager::preCalloutsLibraryHandle()
index dfed9fc4d10afffba1bf4714ffe6fb677f8b6160..e47147d6c88069461e6ae6f5f3e5df1068b59d69 100644 (file)
@@ -54,11 +54,11 @@ public:
 
     ~JSONFileBackendTest() {
         isc::log::setDefaultLoggingOutput();
-        static_cast<void>(unlink(TEST_FILE));
+        static_cast<void>(remove(TEST_FILE));
     };
 
     void writeFile(const std::string& file_name, const std::string& content) {
-        static_cast<void>(unlink(file_name.c_str()));
+        static_cast<void>(remove(file_name.c_str()));
 
         ofstream out(file_name.c_str(), ios::trunc);
         EXPECT_TRUE(out.is_open());
index 082c0df672e6c552159dbab1805022156deab47e..4d2a5cc86eb30517ca8d2f2b9a4d18ae01d050fe 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -35,7 +35,7 @@ public:
     /// @param content text to be written to disk
     void writeFile(const std::string& content) {
         // Write sample content to disk
-        unlink(TEMP_FILE);
+        remove(TEMP_FILE);
         std::ofstream write_me(TEMP_FILE);
         EXPECT_TRUE(write_me.is_open());
         write_me << content;
@@ -44,7 +44,7 @@ public:
 
     /// destructor
     ~DataFileTest() {
-        static_cast<void>(unlink(TEMP_FILE));
+        static_cast<void>(remove(TEMP_FILE));
     }
 
     /// Name of the temporary file
index 241af59c61aec054386183f8c5fd0719670fff5c..b7f05bfbd9e9f8fff95edfa0d546dffac1a8b08c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009,2015  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2009, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -84,7 +84,7 @@ public:
 
     ~TestDomainSocket() {
         socket_.close();
-        unlink(BUNDY_TEST_SOCKET_FILE);
+        remove(BUNDY_TEST_SOCKET_FILE);
     }
 
     static void acceptHandler(const asio::error_code&) {
@@ -164,8 +164,8 @@ class SessionTest : public ::testing::Test {
 protected:
     SessionTest() : sess(my_io_service), work(my_io_service) {
         // The TestDomainSocket is held as a 'new'-ed pointer,
-        // so we can call unlink() first.
-        unlink(BUNDY_TEST_SOCKET_FILE);
+        // so we can call remove() first.
+        remove(BUNDY_TEST_SOCKET_FILE);
         tds = new TestDomainSocket(my_io_service, BUNDY_TEST_SOCKET_FILE);
     }
 
index c4f74ecb652a63567a469e0426dfa567bbdbdc11..666f0ee85d52193f4accf6ff24b8145c04f782a5 100644 (file)
@@ -478,7 +478,7 @@ TEST_F(IfaceMgrTest, dhcp6Sniffer) {
     // Testing socket operation in a portable way is tricky
     // without interface detection implemented
 
-    unlink("interfaces.txt");
+    remove("interfaces.txt");
 
     ofstream interfaces("interfaces.txt", ios::ate);
     interfaces << "eth0 fe80::21e:8cff:fe9b:7349";
index 3be4f589661a2159e45cdebe38bbf53aea60d42d..ea4b642c0e5ea420760f886a48c76d501eab47d8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013,2015  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -54,14 +54,14 @@ public:
         callout_manager_.reset(new CalloutManager(4));
 
         // Ensure the marker file is not present at the start of a test.
-        static_cast<void>(unlink(MARKER_FILE));
+        static_cast<void>(remove(MARKER_FILE));
     }
 
     /// @brief Destructor
     ///
     /// Ensures a marker file is removed after each test.
     ~LibraryManagerTest() {
-        static_cast<void>(unlink(MARKER_FILE));
+        static_cast<void>(remove(MARKER_FILE));
     }
 
     /// @brief Marker file present
index a5f97bdd96538120e9f1745768aac6f1f27accae..37701e73c4d369cbd68005c78d437093526fe868 100644 (file)
@@ -82,7 +82,7 @@ TEST(InterprocessSyncFileTest, TestLock) {
     EXPECT_TRUE(locker.unlock());
     EXPECT_FALSE(locker.isLocked());
 
-    EXPECT_EQ (0, unlink(TEST_DATA_TOPBUILDDIR "/test_lockfile"));
+    EXPECT_EQ (0, remove(TEST_DATA_TOPBUILDDIR "/test_lockfile"));
 }
 
 TEST(InterprocessSyncFileTest, TestMultipleFilesDirect) {
@@ -98,8 +98,8 @@ TEST(InterprocessSyncFileTest, TestMultipleFilesDirect) {
 
   EXPECT_TRUE(locker.unlock());
 
-  EXPECT_EQ (0, unlink(TEST_DATA_TOPBUILDDIR "/test1_lockfile"));
-  EXPECT_EQ (0, unlink(TEST_DATA_TOPBUILDDIR "/test2_lockfile"));
+  EXPECT_EQ (0, remove(TEST_DATA_TOPBUILDDIR "/test1_lockfile"));
+  EXPECT_EQ (0, remove(TEST_DATA_TOPBUILDDIR "/test2_lockfile"));
 }
 
 TEST(InterprocessSyncFileTest, TestMultipleFilesForked) {
@@ -142,12 +142,12 @@ TEST(InterprocessSyncFileTest, TestMultipleFilesForked) {
             EXPECT_EQ(0, locked);
         }
 
-        EXPECT_EQ (0, unlink(TEST_DATA_TOPBUILDDIR "/test2_lockfile"));
+        EXPECT_EQ (0, remove(TEST_DATA_TOPBUILDDIR "/test2_lockfile"));
     }
 
     EXPECT_TRUE(locker.unlock());
 
-    EXPECT_EQ (0, unlink(TEST_DATA_TOPBUILDDIR "/test1_lockfile"));
+    EXPECT_EQ (0, remove(TEST_DATA_TOPBUILDDIR "/test1_lockfile"));
 }
 
 } // unnamed namespace
index e3ca27290e118d665af91e979c065ba780a18f84..99a065c21e1f7c322648bfd383a62d7d65fd96d5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011,2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011, 2015 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -82,11 +82,11 @@ public:
     // Destructor, remove the file.  This is only a test, so ignore failures
     ~SpecificationForFileLogger() {
         if (! name_.empty()) {
-            static_cast<void>(unlink(name_.c_str()));
+            static_cast<void>(remove(name_.c_str()));
 
             // Depending on the log4cplus version, a lock file may also be
             // created.
-            static_cast<void>(unlink((name_ + ".lock").c_str()));
+            static_cast<void>(remove((name_ + ".lock").c_str()));
         }
     }
 
@@ -195,7 +195,7 @@ TEST_F(LoggerManagerTest, FileLogger) {
     // For the first test, we want to check that the file is created
     // if it does not already exist.  So delete the temporary file before
     // logging the first message.
-    unlink(file_spec.getFileName().c_str());
+    remove(file_spec.getFileName().c_str());
 
     // Set up the file appenders.
     LoggerManager manager;
@@ -269,7 +269,7 @@ TEST_F(LoggerManagerTest, FileSizeRollover) {
     for (int i = 0; i < 3; ++i) {
         prev_name.push_back(file_spec.getFileName() + "." +
                             boost::lexical_cast<string>(i + 1));
-        (void) unlink(prev_name[i].c_str());
+        (void) remove(prev_name[i].c_str());
     }
 
     // Generate an argument for a message that ensures that the message when
@@ -325,7 +325,7 @@ TEST_F(LoggerManagerTest, FileSizeRollover) {
 
     // Tidy up
     for (vector<string>::size_type i = 0; i < prev_name.size(); ++i) {
-       (void) unlink(prev_name[i].c_str());
+       (void) remove(prev_name[i].c_str());
     }
 }
 
@@ -368,7 +368,7 @@ TEST_F(LoggerManagerTest, checkLayoutPattern) {
     // For the first test, we want to check that the file is created
     // if it does not already exist.  So delete the temporary file before
     // logging the first message.
-    unlink(file_spec.getFileName().c_str());
+    remove(file_spec.getFileName().c_str());
 
     // Set up the file appenders.
     LoggerManager manager;
index 1f9c0776078545de96e8b9a2103aa5cffc382b61..7657c38a0b8309f3506ebe02fcca69f5b772a8df 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -159,7 +159,7 @@ protected:
                     large_text_(65535, 'a'),
                     test_un_len_(2 + strlen(TEST_UNIX_FILE))
     {
-        unlink(TEST_UNIX_FILE);
+        remove(TEST_UNIX_FILE);
         test_un_.sun_family = AF_UNIX;
         strncpy(test_un_.sun_path, TEST_UNIX_FILE, sizeof(test_un_.sun_path));
 #ifdef HAVE_SA_LEN
@@ -171,7 +171,7 @@ protected:
         if (listen_fd_ != -1) {
             close(listen_fd_);
         }
-        unlink(TEST_UNIX_FILE);
+        remove(TEST_UNIX_FILE);
     }
 
     // Start an internal "socket session server".