|
1 | 1 | /* |
2 | | - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -60,7 +60,6 @@ static char *isFileIdentical(char* buf, size_t size, char *pathname); |
60 | 60 | #endif |
61 | 61 |
|
62 | 62 | #if defined(__linux__) || defined(_ALLBSD_SOURCE) |
63 | | -static const char *ETC_TIMEZONE_FILE = "/etc/timezone"; |
64 | 63 | static const char *ZONEINFO_DIR = "/usr/share/zoneinfo"; |
65 | 64 | static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime"; |
66 | 65 | #else |
@@ -239,40 +238,13 @@ getPlatformTimeZoneID() |
239 | 238 | { |
240 | 239 | struct stat64 statbuf; |
241 | 240 | char *tz = NULL; |
242 | | - FILE *fp; |
243 | 241 | int fd; |
244 | 242 | char *buf; |
245 | 243 | size_t size; |
246 | 244 | int res; |
247 | 245 |
|
248 | | -#if defined(__linux__) |
249 | | - /* |
250 | | - * Try reading the /etc/timezone file for Debian distros. There's |
251 | | - * no spec of the file format available. This parsing assumes that |
252 | | - * there's one line of an Olson tzid followed by a '\n', no |
253 | | - * leading or trailing spaces, no comments. |
254 | | - */ |
255 | | - if ((fp = fopen(ETC_TIMEZONE_FILE, "r")) != NULL) { |
256 | | - char line[256]; |
257 | | - |
258 | | - if (fgets(line, sizeof(line), fp) != NULL) { |
259 | | - char *p = strchr(line, '\n'); |
260 | | - if (p != NULL) { |
261 | | - *p = '\0'; |
262 | | - } |
263 | | - if (strlen(line) > 0) { |
264 | | - tz = strdup(line); |
265 | | - } |
266 | | - } |
267 | | - (void) fclose(fp); |
268 | | - if (tz != NULL) { |
269 | | - return tz; |
270 | | - } |
271 | | - } |
272 | | -#endif /* defined(__linux__) */ |
273 | | - |
274 | 246 | /* |
275 | | - * Next, try /etc/localtime to find the zone ID. |
| 247 | + * Try /etc/localtime to find the zone ID. |
276 | 248 | */ |
277 | 249 | RESTARTABLE(lstat64(DEFAULT_ZONEINFO_FILE, &statbuf), res); |
278 | 250 | if (res == -1) { |
|
0 commit comments