git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] Fix detection of uname failure

From
Charles Bailey <charles@hashpling.org>
Date
Jul 17, 2015, 17:09 UTC
Message-ID
<1437152981-28855-1-git-send-email-charles@hashpling.org>
In-Reply-To
<ef7d56584c3b5d6431f895df1d94eba8@www.dscho.org>
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..1d42811 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) < 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);
-- 
2.4.0.53.g8440f74
Previous: Junio C HamanoNext: Johannes Schindelin
Message 5 of 8 in “Fix detection of uname failure”
  1. Fix detection of uname failureCharles Bailey, Jul 17, 2015
  2. Johannes SchindelinJul 17, 2015
  3. Charles BaileyJul 17, 2015
  4. Junio C HamanoJul 17, 2015
  5. Fix detection of uname failureCharles Bailey, Jul 17, 2015
  6. Johannes SchindelinJul 17, 2015
  7. Junio C HamanoJul 17, 2015
  8. Johannes SchindelinJul 18, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.