From ea54b844fb8d41241db5cd2088319e226cfd8b68 Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周六, 16 5月 2020 22:08:05 +0800
Subject: [PATCH] tentative fix for issue #92 and #97

---
 src/library/os/linux/execution_environment.cpp |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/library/os/linux/execution_environment.cpp b/src/library/os/linux/execution_environment.cpp
index 7df96e9..75520eb 100644
--- a/src/library/os/linux/execution_environment.cpp
+++ b/src/library/os/linux/execution_environment.cpp
@@ -18,7 +18,7 @@
 #include "../cpu_info.hpp"
 #include "../execution_environment.hpp"
 #include "../../base/file_utils.hpp"
-#include "../../base/StringUtils.h"
+#include "../../base/string_utils.h"
 
 namespace license {
 namespace os {
@@ -40,11 +40,11 @@
 	char *line = NULL;
 	size_t len = 0;
 	ssize_t read;
-	CONTAINER_TYPE result = NONE;
+	CONTAINER_TYPE result = CONTAINER_TYPE::NONE;
 
 	fp = fopen(proc_path, "r");
 	if (fp == NULL) {
-		return NONE;
+		return CONTAINER_TYPE::NONE;
 	}
 
 	while ((read = getline(&line, &len, fp)) != -1 && result == 0) {
@@ -52,10 +52,10 @@
 		// printf("Retrieved line of length %zu:\n", read);
 		// printf("%s", line);
 		if (strstr(line, "docker") != NULL) {
-			result = DOCKER;
+			result = CONTAINER_TYPE::DOCKER;
 		}
 		if (strstr(line, "lxc") != NULL) {
-			result = LXC;
+			result = CONTAINER_TYPE::LXC;
 		}
 	}
 
@@ -67,15 +67,15 @@
 // 0=NO 1=Docker/2=Lxc
 static CONTAINER_TYPE checkSystemdContainer() {
 	ifstream systemd_container("/var/run/systemd/container");
-	CONTAINER_TYPE result = NONE;
+	CONTAINER_TYPE result = CONTAINER_TYPE::NONE;
 	if (systemd_container.good()) {
-		result = DOCKER;
+		result = CONTAINER_TYPE::DOCKER;
 		for (string line; getline(systemd_container, line);) {
 			if (line.find("docker") != string::npos) {
-				result = DOCKER;
+				result = CONTAINER_TYPE::DOCKER;
 				break;
 			} else if (line.find("lxc") != string::npos) {
-				result = LXC;
+				result = CONTAINER_TYPE::LXC;
 				break;
 			}
 		}
@@ -85,7 +85,7 @@
 
 static CONTAINER_TYPE get_container_type() {
 	CONTAINER_TYPE result = checkContainerProc();
-	if (result == NONE) {
+	if (result == CONTAINER_TYPE::NONE) {
 		result = checkSystemdContainer();
 	}
 	return result;

--
Gitblit v1.9.1