git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Charles Bailey <charles@hashpling.org>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: [PATCH] Fix detection of uname failure
Date: Fri, 17 Jul 2015 13:11:35 +0100	[thread overview]
Message-ID: <1437135095-6244-1-git-send-email-charles@hashpling.org> (raw)

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

             reply	other threads:[~2015-07-17 12:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-17 12:11 Charles Bailey [this message]
2015-07-17 13:06 ` [PATCH] Fix detection of uname failure 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437135095-6244-1-git-send-email-charles@hashpling.org \
    --to=charles@hashpling.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).