From 8b71bbd2b1a7e71c269fead043c01c4d8ebd4d0d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 9 May 2023 21:04:24 +0200 Subject: [PATCH] setting_helpers: suplement to "setting_helpers: reduce dub code parts" Init of zone was incomplete Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e3555f2e69399927edc8452ed5e6bab9018593dc Author: Thilo Graf Date: 2023-05-09 (Tue, 09 May 2023) ------------------ This commit was generated by Migit --- src/system/setting_helpers.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 29bdf9844..cc813df66 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -65,6 +65,7 @@ #include #include #include + #include #include @@ -617,9 +618,9 @@ std::string CNetAdapter::getMacAddr(void) bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void *Data) { bool found = false; - std::string name, zone; + std::string name, zoneinfo, zone; + zoneinfo = TARGET_PREFIX "/share/zoneinfo/"; printf("CTZChangeNotifier::changeNotify: %s\n", (char *) Data); - std::string zoneinfo = TARGET_PREFIX "/share/zoneinfo/" + zone; xmlDocPtr parser = parseXmlFile("/etc/timezone.xml"); if (parser != NULL) @@ -639,10 +640,11 @@ bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void *Data) const char *zptr = xmlGetAttribute(search, "zone"); if (zptr) zone = zptr; - if (!access(zoneinfo.c_str(), R_OK)) + std::string Zone = zoneinfo + zone; + if (!access(Zone.c_str(), R_OK)) found = true; else - dprintf(DEBUG_NORMAL, "[CTZChangeNotifier] [%s - %d] %s not found\n", __func__, __LINE__, zoneinfo.c_str()); + dprintf(DEBUG_NORMAL, "[CTZChangeNotifier] [%s - %d] %s not found\n", __func__, __LINE__, Zone.c_str()); break; } } @@ -653,7 +655,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 = zoneinfo; + std::string cmd = zoneinfo + zone; printf("symlink %s to /etc/localtime\n", cmd.c_str()); if (unlink("/etc/localtime")) perror("unlink failed");