git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Fix detection of uname failure
@ 2015-07-17 12:11 Charles Bailey
  2015-07-17 13:06 ` Johannes Schindelin
  0 siblings, 1 reply; 8+ messages in thread
From: Charles Bailey @ 2015-07-17 12:11 UTC (permalink / raw)
  To: Junio C Hamano, git

From: Charles Bailey <cbailey32@bloomberg.net>

According to POSIX specification uname 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 <cbailey32@bloomberg.net>
---
 dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dir.c b/dir.c
index 8209f8b..52dbfd0 100644
--- a/dir.c
+++ b/dir.c
@@ -1848,7 +1848,7 @@ static const char *get_ident_string(void)
 
 	if (sb.len)
 		return sb.buf;
-	if (uname(&uts))
+	if (uname(&uts) == -1)
 		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);
-- 
2.4.0.53.g8440f74

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-07-18  6:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-17 12:11 [PATCH] Fix detection of uname failure Charles Bailey
2015-07-17 13:06 ` Johannes Schindelin
2015-07-17 17:01   ` Charles Bailey
2015-07-17 17:09     ` Junio C Hamano
2015-07-17 17:09   ` [PATCH v2] " Charles Bailey
2015-07-17 21:07     ` Johannes Schindelin
2015-07-17 21:39       ` Junio C Hamano
2015-07-18  6:58         ` Johannes Schindelin

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).