Skip to content

Commit

Permalink
untracked: fix detection of uname(2) failure
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
hashpling authored and gitster committed Jul 17, 2015
1 parent 1e8fef6 commit 100e433
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 100e433

Please sign in to comment.