Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
90725504
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
90725504
编写于
8月 31, 2009
作者:
P
peytoia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6456628: (tz) Default timezone is incorrectly set occasionally on Linux
Reviewed-by: okutsu
上级
52987bad
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
50 deletion
+19
-50
src/solaris/native/java/util/TimeZone_md.c
src/solaris/native/java/util/TimeZone_md.c
+19
-50
未找到文件。
src/solaris/native/java/util/TimeZone_md.c
浏览文件 @
90725504
...
...
@@ -51,9 +51,9 @@
#ifdef __linux__
static
const
char
*
sysconfig_clock_file
=
"/etc/sysconfig/clock
"
;
static
const
char
*
zoneinfo_dir
=
"/usr/share/zoneinfo"
;
static
const
char
*
defailt_zoneinfo_file
=
"/etc/localtime"
;
static
const
char
*
ETC_TIMEZONE_FILE
=
"/etc/timezone
"
;
static
const
char
*
ZONEINFO_DIR
=
"/usr/share/zoneinfo"
;
static
const
char
*
DEFAULT_ZONEINFO_FILE
=
"/etc/localtime"
;
/*
* Returns a point to the zone ID portion of the given zoneinfo file
...
...
@@ -201,53 +201,22 @@ getPlatformTimeZoneID()
size_t
size
;
/*
* First, try the ZONE entry in /etc/sysconfig/clock. However, the
* ZONE entry is not set up after initial Red Hat Linux
* installation. In case that /etc/localtime is set up without
* using timeconfig, there might be inconsistency between
* /etc/localtime and the ZONE entry. The inconsistency between
* timeconfig and linuxconf is reported as a bug in the Red Hat
* web page as of May 1, 2000.
* Try reading the /etc/timezone file for Debian distros. There's
* no spec of the file format available. This parsing assumes that
* there's one line of an Olson tzid followed by a '\n', no
* leading or trailing spaces, no comments.
*/
if
((
fp
=
fopen
(
sysconfig_clock_file
,
"r"
))
!=
NULL
)
{
if
((
fp
=
fopen
(
ETC_TIMEZONE_FILE
,
"r"
))
!=
NULL
)
{
char
line
[
256
];
while
(
fgets
(
line
,
sizeof
(
line
),
fp
)
!=
NULL
)
{
char
*
p
=
line
;
char
*
s
;
SKIP_SPACE
(
p
);
if
(
*
p
!=
'Z'
)
{
continue
;
}
if
(
strncmp
(
p
,
"ZONE=
\"
"
,
6
)
==
0
)
{
p
+=
6
;
}
else
{
/*
* In case we need to parse it token by token.
*/
if
(
strncmp
(
p
,
"ZONE"
,
4
)
!=
0
)
{
continue
;
}
p
+=
4
;
SKIP_SPACE
(
p
);
if
(
*
p
++
!=
'='
)
{
break
;
}
SKIP_SPACE
(
p
);
if
(
*
p
++
!=
'"'
)
{
break
;
}
if
(
fgets
(
line
,
sizeof
(
line
),
fp
)
!=
NULL
)
{
char
*
p
=
strchr
(
line
,
'\n'
);
if
(
p
!=
NULL
)
{
*
p
=
'\0'
;
}
for
(
s
=
p
;
*
s
&&
*
s
!=
'"'
;
s
++
)
;
if
(
*
s
!=
'"'
)
{
/* this ZONE entry is broken. */
break
;
if
(
strlen
(
line
)
>
0
)
{
tz
=
strdup
(
line
);
}
*
s
=
'\0'
;
tz
=
strdup
(
p
);
break
;
}
(
void
)
fclose
(
fp
);
if
(
tz
!=
NULL
)
{
...
...
@@ -258,7 +227,7 @@ getPlatformTimeZoneID()
/*
* Next, try /etc/localtime to find the zone ID.
*/
if
(
lstat
(
defailt_zoneinfo_file
,
&
statbuf
)
==
-
1
)
{
if
(
lstat
(
DEFAULT_ZONEINFO_FILE
,
&
statbuf
)
==
-
1
)
{
return
NULL
;
}
...
...
@@ -273,9 +242,9 @@ getPlatformTimeZoneID()
char
linkbuf
[
PATH_MAX
+
1
];
int
len
;
if
((
len
=
readlink
(
defailt_zoneinfo_file
,
linkbuf
,
sizeof
(
linkbuf
)
-
1
))
==
-
1
)
{
if
((
len
=
readlink
(
DEFAULT_ZONEINFO_FILE
,
linkbuf
,
sizeof
(
linkbuf
)
-
1
))
==
-
1
)
{
jio_fprintf
(
stderr
,
(
const
char
*
)
"can't get a symlink of %s
\n
"
,
defailt_zoneinfo_file
);
DEFAULT_ZONEINFO_FILE
);
return
NULL
;
}
linkbuf
[
len
]
=
'\0'
;
...
...
@@ -295,7 +264,7 @@ getPlatformTimeZoneID()
if
(
buf
==
NULL
)
{
return
NULL
;
}
if
((
fd
=
open
(
defailt_zoneinfo_file
,
O_RDONLY
))
==
-
1
)
{
if
((
fd
=
open
(
DEFAULT_ZONEINFO_FILE
,
O_RDONLY
))
==
-
1
)
{
free
((
void
*
)
buf
);
return
NULL
;
}
...
...
@@ -307,7 +276,7 @@ getPlatformTimeZoneID()
}
(
void
)
close
(
fd
);
tz
=
findZoneinfoFile
(
buf
,
size
,
zoneinfo_dir
);
tz
=
findZoneinfoFile
(
buf
,
size
,
ZONEINFO_DIR
);
free
((
void
*
)
buf
);
return
tz
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录