From bea4ac652c1b868b4945270378e0573ed0f7cbac Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 9 May 2023 21:04:24 +0200 Subject: [PATCH] Revert "Revert "setting_helpers: reduce dub code parts"" This reverts commit 7e78f2196d7f255414109a99678fcd602f85c6d5. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/698988dbeeb37876971e217aedc450c8293ea0d0 Author: vanhofen Date: 2023-05-09 (Tue, 09 May 2023) ------------------ This commit was generated by Migit --- src/system/setting_helpers.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index dab1943ac..29bdf9844 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -64,7 +64,7 @@ #include #include #include - +#include #include #include @@ -619,6 +619,7 @@ bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void *Data) bool found = false; std::string name, zone; printf("CTZChangeNotifier::changeNotify: %s\n", (char *) Data); + std::string zoneinfo = TARGET_PREFIX "/share/zoneinfo/" + zone; xmlDocPtr parser = parseXmlFile("/etc/timezone.xml"); if (parser != NULL) @@ -638,8 +639,10 @@ bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void *Data) const char *zptr = xmlGetAttribute(search, "zone"); if (zptr) zone = zptr; - if (!access(TARGET_PREFIX "/share/zoneinfo/" + zone, R_OK)) + if (!access(zoneinfo.c_str(), R_OK)) found = true; + else + dprintf(DEBUG_NORMAL, "[CTZChangeNotifier] [%s - %d] %s not found\n", __func__, __LINE__, zoneinfo.c_str()); break; } } @@ -650,7 +653,7 @@ bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void *Data) if (found) { printf("Timezone: %s -> %s\n", name.c_str(), zone.c_str()); - std::string cmd = TARGET_PREFIX "/share/zoneinfo/" + zone; + std::string cmd = zoneinfo; printf("symlink %s to /etc/localtime\n", cmd.c_str()); if (unlink("/etc/localtime")) perror("unlink failed");