Commit 8c6fbe3a authored by Francis Dupont's avatar Francis Dupont
Browse files

[3841] replaced unlink by remove

parent 39167c04
......@@ -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
......
......@@ -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
......
......@@ -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));
}
};
......
......@@ -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());
......
......@@ -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
......
// 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));
}
};
......
......@@ -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);
......
......@@ -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()
......
......@@ -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());
......
// 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
......
// 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);
}
......
......@@ -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";
......
// 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
......
......@@ -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
// 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;
......
// 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".
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment