提交 100e4337 编写于 作者: C Charles Bailey 提交者: Junio C Hamano

untracked: fix detection of uname(2) failure

According to POSIX specification uname(2) must return -1 on failure
and a non-negative value on success.  Although many implementations
do return 0 on success it is valid to return any positive value for
success.  In particular, Solaris returns 1.
Signed-off-by: NCharles Bailey <cbailey32@bloomberg.net>
Reviewed-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 1e8fef60
......@@ -1801,7 +1801,7 @@ static const char *get_ident_string(void)
if (sb.len)
return sb.buf;
if (uname(&uts))
if (uname(&uts) < 0)
die_errno(_("failed to get kernel name and information"));
strbuf_addf(&sb, "Location %s, system %s %s %s", get_git_work_tree(),
uts.sysname, uts.release, uts.version);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册