From: Francis Dupont Date: Tue, 12 May 2015 20:51:43 +0000 (+0200) Subject: [3841] replaced unlink by remove X-Git-Tag: trac3919_base~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c6fbe3a53926d64a816d6d9a26cfcd6aa8c8656;p=thirdparty%2Fkea.git [3841] replaced unlink by remove --- diff --git a/src/bin/d2/tests/d_test_stubs.h b/src/bin/d2/tests/d_test_stubs.h index 23d4efcd29..c0ec58c75b 100644 --- a/src/bin/d2/tests/d_test_stubs.h +++ b/src/bin/d2/tests/d_test_stubs.h @@ -359,7 +359,7 @@ public: } getController().reset(); - static_cast(unlink(CFG_TEST_FILE)); + static_cast(remove(CFG_TEST_FILE)); } /// @brief Convenience method that destructs and then recreates the diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index 7cb289ca06..097ef69b35 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -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 diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index 5f111b4fb9..8389cdfe86 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -68,8 +68,8 @@ public: HooksManager::unloadLibraries(); // Get rid of any marker files. - static_cast(unlink(LOAD_MARKER_FILE)); - static_cast(unlink(UNLOAD_MARKER_FILE)); + static_cast(remove(LOAD_MARKER_FILE)); + static_cast(remove(UNLOAD_MARKER_FILE)); } }; diff --git a/src/bin/dhcp4/tests/kea_controller_unittest.cc b/src/bin/dhcp4/tests/kea_controller_unittest.cc index d98621ed0e..fc974bb626 100644 --- a/src/bin/dhcp4/tests/kea_controller_unittest.cc +++ b/src/bin/dhcp4/tests/kea_controller_unittest.cc @@ -59,7 +59,7 @@ public: ~JSONFileBackendTest() { isc::log::setDefaultLoggingOutput(); - static_cast(unlink(TEST_FILE)); + static_cast(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(unlink(TEST_FILE)); + static_cast(remove(TEST_FILE)); ofstream out(TEST_FILE, ios::trunc); EXPECT_TRUE(out.is_open()); diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index f843b160ea..89d7e493a0 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -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 diff --git a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc index 110adc8fbb..3734d1ad94 100644 --- a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc @@ -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(unlink(LOAD_MARKER_FILE)); - static_cast(unlink(UNLOAD_MARKER_FILE)); + static_cast(remove(LOAD_MARKER_FILE)); + static_cast(remove(UNLOAD_MARKER_FILE)); } }; diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc index 8548d9947d..ca17594ba8 100644 --- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc @@ -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); diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.h b/src/bin/dhcp6/tests/dhcp6_test_utils.h index 499ebdea32..de8a51c330 100644 --- a/src/bin/dhcp6/tests/dhcp6_test_utils.h +++ b/src/bin/dhcp6/tests/dhcp6_test_utils.h @@ -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() diff --git a/src/bin/dhcp6/tests/kea_controller_unittest.cc b/src/bin/dhcp6/tests/kea_controller_unittest.cc index dfed9fc4d1..e47147d6c8 100644 --- a/src/bin/dhcp6/tests/kea_controller_unittest.cc +++ b/src/bin/dhcp6/tests/kea_controller_unittest.cc @@ -54,11 +54,11 @@ public: ~JSONFileBackendTest() { isc::log::setDefaultLoggingOutput(); - static_cast(unlink(TEST_FILE)); + static_cast(remove(TEST_FILE)); }; void writeFile(const std::string& file_name, const std::string& content) { - static_cast(unlink(file_name.c_str())); + static_cast(remove(file_name.c_str())); ofstream out(file_name.c_str(), ios::trunc); EXPECT_TRUE(out.is_open()); diff --git a/src/lib/cc/tests/data_file_unittests.cc b/src/lib/cc/tests/data_file_unittests.cc index 082c0df672..4d2a5cc86e 100644 --- a/src/lib/cc/tests/data_file_unittests.cc +++ b/src/lib/cc/tests/data_file_unittests.cc @@ -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(unlink(TEMP_FILE)); + static_cast(remove(TEMP_FILE)); } /// Name of the temporary file diff --git a/src/lib/cc/tests/session_unittests.cc b/src/lib/cc/tests/session_unittests.cc index 241af59c61..b7f05bfbd9 100644 --- a/src/lib/cc/tests/session_unittests.cc +++ b/src/lib/cc/tests/session_unittests.cc @@ -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); } diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc index c4f74ecb65..666f0ee85d 100644 --- a/src/lib/dhcp/tests/iface_mgr_unittest.cc +++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc @@ -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"; diff --git a/src/lib/hooks/tests/library_manager_unittest.cc b/src/lib/hooks/tests/library_manager_unittest.cc index 3be4f58966..ea4b642c0e 100644 --- a/src/lib/hooks/tests/library_manager_unittest.cc +++ b/src/lib/hooks/tests/library_manager_unittest.cc @@ -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(unlink(MARKER_FILE)); + static_cast(remove(MARKER_FILE)); } /// @brief Destructor /// /// Ensures a marker file is removed after each test. ~LibraryManagerTest() { - static_cast(unlink(MARKER_FILE)); + static_cast(remove(MARKER_FILE)); } /// @brief Marker file present diff --git a/src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc b/src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc index a5f97bdd96..37701e73c4 100644 --- a/src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc +++ b/src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc @@ -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 diff --git a/src/lib/log/tests/logger_manager_unittest.cc b/src/lib/log/tests/logger_manager_unittest.cc index e3ca27290e..99a065c21e 100644 --- a/src/lib/log/tests/logger_manager_unittest.cc +++ b/src/lib/log/tests/logger_manager_unittest.cc @@ -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(unlink(name_.c_str())); + static_cast(remove(name_.c_str())); // Depending on the log4cplus version, a lock file may also be // created. - static_cast(unlink((name_ + ".lock").c_str())); + static_cast(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(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::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; diff --git a/src/lib/util/tests/socketsession_unittest.cc b/src/lib/util/tests/socketsession_unittest.cc index 1f9c077607..7657c38a0b 100644 --- a/src/lib/util/tests/socketsession_unittest.cc +++ b/src/lib/util/tests/socketsession_unittest.cc @@ -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".