Skip to content

Commit 100e433

Browse files
hashplinggitster
authored andcommitted
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: Charles Bailey <[email protected]> Reviewed-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1e8fef6 commit 100e433

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@ static const char *get_ident_string(void)
18011801

18021802
if (sb.len)
18031803
return sb.buf;
1804-
if (uname(&uts))
1804+
if (uname(&uts) < 0)
18051805
die_errno(_("failed to get kernel name and information"));
18061806
strbuf_addf(&sb, "Location %s, system %s %s %s", get_git_work_tree(),
18071807
uts.sysname, uts.release, uts.version);

0 commit comments

Comments
 (0)