From c607434f2ad754b1a272cbac15f7f3adf0080110 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 29 Jun 2021 09:33:43 +0200 Subject: [PATCH] helpers.cpp: supplement to: 5289cb6 helpers.cpp: fix possible crash --- src/system/helpers.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index ad0712da8..ae0915f58 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -470,8 +470,11 @@ bool exec_controlscript(std::string script) bool exec_initscript(std::string script, std::string command, std::string system_command) { const char* user = getenv("USER"); - if (strncmp("root", user, 4)) - dprintf(DEBUG_NORMAL, "[helpers] [%s - %d] NOTE: current user %s is not root!\n", __func__, __LINE__, user); + if (user != NULL) + { + if (strncmp("root", user, 4)) + dprintf(DEBUG_NORMAL,"[helpers] [%s - %d] NOTE: current user %s is not root!\n", __func__, __LINE__, user); + } int ret = 1; if (system_command == "service")