Commit d6e33479 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[992] Cosmetic changes (a follow-up to 1361)

parent 64546f4f
...@@ -30,7 +30,8 @@ using namespace isc::asiolink; ...@@ -30,7 +30,8 @@ using namespace isc::asiolink;
using namespace isc::dhcp; using namespace isc::dhcp;
// name of loopback interface detection // name of loopback interface detection
char LOOPBACK[32] = "lo"; const size_t buf_size = 32;
char LOOPBACK[buf_size] = "lo";
namespace { namespace {
const char* const INTERFACE_FILE = TEST_DATA_BUILDDIR "/interfaces.txt"; const char* const INTERFACE_FILE = TEST_DATA_BUILDDIR "/interfaces.txt";
...@@ -70,16 +71,16 @@ TEST_F(IfaceMgrTest, loDetect) { ...@@ -70,16 +71,16 @@ TEST_F(IfaceMgrTest, loDetect) {
// poor man's interface detection // poor man's interface detection
// it will go away as soon as proper interface detection // it will go away as soon as proper interface detection
// is implemented // is implemented
if (if_nametoindex("lo")>0) { if (if_nametoindex("lo") > 0) {
cout << "This is Linux, using lo as loopback." << endl; cout << "This is Linux, using lo as loopback." << endl;
sprintf(LOOPBACK, "lo"); snprintf(LOOPBACK, buf_size - 1, "lo");
} else if (if_nametoindex("lo0")>0) { } else if (if_nametoindex("lo0") > 0) {
cout << "This is BSD, using lo0 as loopback." << endl; cout << "This is BSD, using lo0 as loopback." << endl;
sprintf(LOOPBACK, "lo0"); snprintf(LOOPBACK, buf_size - 1, "lo0");
} else { } else {
cout << "Failed to detect loopback interface. Neither " cout << "Failed to detect loopback interface. Neither "
<< "lo or lo0 worked. I give up." << endl; << "lo nor lo0 worked. I give up." << endl;
ASSERT_TRUE(false); FAIL();
} }
} }
......
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