From 4b7e3271e3ad8b2fda6fadead733a3fa9bad8dab Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周日, 25 10月 2020 20:10:00 +0800
Subject: [PATCH] disk strategy failing on windows

---
 src/library/os/linux/network.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/library/os/linux/network.cpp b/src/library/os/linux/network.cpp
index 1f7a76a..1281aca 100644
--- a/src/library/os/linux/network.cpp
+++ b/src/library/os/linux/network.cpp
@@ -28,7 +28,7 @@
 #include <string.h>
 #include <memory.h>
 
-#include "../../base/StringUtils.h"
+#include "../../base/string_utils.h"
 #include "../../base/logger.h"
 #include "../network.hpp"
 
@@ -60,7 +60,7 @@
 		if (ifa->ifa_addr == NULL || (ifa->ifa_flags & IFF_LOOPBACK) != 0) {
 			continue;
 		}
-		string if_name(ifa->ifa_name, mstrnlen_s(ifa->ifa_name, NI_MAXHOST));
+		string if_name(ifa->ifa_name, mstrnlen_s(ifa->ifa_name, LCC_ADAPTER_DESCRIPTION_LEN));
 		// if_name_position = ifname_position(ifnames, ifa->ifa_name, if_num);
 		// interface name not seen en advance
 		OsAdapterInfo *currentAdapter;
@@ -68,7 +68,7 @@
 		if (adapterByName.find(if_name) == adapterByName.end()) {
 			OsAdapterInfo newAdapter;
 			memset(&newAdapter, 0, sizeof(OsAdapterInfo));
-			strncpy(&newAdapter.description[0], ifa->ifa_name, NI_MAXHOST);
+			strncpy(&newAdapter.description[0], ifa->ifa_name, LCC_ADAPTER_DESCRIPTION_LEN);
 			adapterByName[if_name] = newAdapter;
 		}
 		auto it = adapterByName.find(if_name);
@@ -76,7 +76,7 @@
 		family = ifa->ifa_addr->sa_family;
 		/* Display interface name and family (including symbolic
 		 form of the latter for the common families) */
-#ifdef _DEBUG
+#ifndef NDEBUG
 		printf("%-8s %s (%d)\n", ifa->ifa_name,
 			   (family == AF_PACKET) ? "AF_PACKET"
 									 : (family == AF_INET) ? "AF_INET" : (family == AF_INET6) ? "AF_INET6" : "???",
@@ -97,11 +97,11 @@
 			int i;
 			for (i = 0; i < 6; i++) {
 				currentAdapter->mac_address[i] = s1->sll_addr[i];
-#ifdef _DEBUG
+#ifndef NDEBUG
 				printf("%02x:", s1->sll_addr[i]);
 #endif
 			}
-#ifdef _DEBUG
+#ifndef NDEBUG
 			printf("\t %s\n", ifa->ifa_name);
 #endif
 		}

--
Gitblit v1.9.1