|
1 | 1 | /*
|
2 |
| - * Copyright (c) 1999, 2024, 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
|
|
46 | 46 | #define fileclose fclose
|
47 | 47 |
|
48 | 48 | #if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
49 |
| -static const char *ETC_TIMEZONE_FILE = "/etc/timezone"; |
50 | 49 | static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
|
51 | 50 | static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
|
52 | 51 | #else
|
@@ -248,40 +247,13 @@ getPlatformTimeZoneID()
|
248 | 247 | {
|
249 | 248 | struct stat statbuf;
|
250 | 249 | char *tz = NULL;
|
251 |
| - FILE *fp; |
252 | 250 | int fd;
|
253 | 251 | char *buf;
|
254 | 252 | size_t size;
|
255 | 253 | int res;
|
256 | 254 |
|
257 |
| -#if defined(__linux__) |
258 |
| - /* |
259 |
| - * Try reading the /etc/timezone file for Debian distros. There's |
260 |
| - * no spec of the file format available. This parsing assumes that |
261 |
| - * there's one line of an Olson tzid followed by a '\n', no |
262 |
| - * leading or trailing spaces, no comments. |
263 |
| - */ |
264 |
| - if ((fp = fopen(ETC_TIMEZONE_FILE, "r")) != NULL) { |
265 |
| - char line[256]; |
266 |
| - |
267 |
| - if (fgets(line, sizeof(line), fp) != NULL) { |
268 |
| - char *p = strchr(line, '\n'); |
269 |
| - if (p != NULL) { |
270 |
| - *p = '\0'; |
271 |
| - } |
272 |
| - if (strlen(line) > 0) { |
273 |
| - tz = strdup(line); |
274 |
| - } |
275 |
| - } |
276 |
| - (void) fclose(fp); |
277 |
| - if (tz != NULL) { |
278 |
| - return tz; |
279 |
| - } |
280 |
| - } |
281 |
| -#endif /* defined(__linux__) */ |
282 |
| - |
283 | 255 | /*
|
284 |
| - * Next, try /etc/localtime to find the zone ID. |
| 256 | + * Try /etc/localtime to find the zone ID. |
285 | 257 | */
|
286 | 258 | RESTARTABLE(lstat(DEFAULT_ZONEINFO_FILE, &statbuf), res);
|
287 | 259 | if (res == -1) {
|
|
0 commit comments