Changeset 98104 in vbox
- Timestamp:
- Jan 17, 2023 2:47:49 PM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/RTTimeZoneGetCurrent-posix.cpp
r98103 r98104 80 80 * <tzfile.h>:TZDIR (normally /usr/share/zoneinfo), 81 81 * e.g. Europe/London, or Etc/UTC, or UTC, or etc. 82 * 83 * @note File format is documented in RFC-8536. 82 84 */ 83 85 static int rtIsValidTimeZoneFile(const char *pszTimeZone) … … 218 220 * Older versions of RedHat / OEL don't have /etc/localtime as a symlink or 219 221 * /etc/timezone but instead have /etc/sysconfig/clock which contains a line 220 * of the syntax ZONE=Europe/London amongst other entries.222 * of the syntax ZONE=Europe/London or ZONE="Europe/London" amongst other entries. 221 223 */ 222 224 pszPath = PATH_SYSCONFIG_CLOCK; … … 230 232 { 231 233 static char const s_szVarEq[] = "ZONE="; 232 if (memcmp(szBuf, RT_STR_TUPLE(s_szVarEq)) == 0) 234 char *pszStart = RTStrStrip(szBuf); 235 if (memcmp(pszStart, RT_STR_TUPLE(s_szVarEq)) == 0) 233 236 { 234 const char *pszTimeZone = &szBuf[sizeof(s_szVarEq) - 1]; 237 char *pszTimeZone = &pszStart[sizeof(s_szVarEq) - 1]; 238 239 /* Drop any quoting before using the value, assuming it is plain stuff: */ 240 if (*pszTimeZone == '\"' || *pszTimeZone == '\'') 241 { 242 pszTimeZone++; 243 size_t const cchTimeZone = strlen(pszTimeZone); 244 if (cchTimeZone && (pszTimeZone[cchTimeZone - 1] == '"' || pszTimeZone[cchTimeZone - 1] == '\'')) 245 pszTimeZone[cchTimeZone - 1] = '\0'; 246 } 247 235 248 rc = rtIsValidTimeZoneFile(pszTimeZone); 236 249 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.