Git development
 help / color / mirror / Atom feed
From: Jakub Kulik <jakub.kulik@oracle.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Jakub Kulik <jakub.kulik@oracle.com>
Subject: [PATCH] version: accept positive uname(2) return values
Date: Wed, 18 Nov 2026 17:01:47 +0100	[thread overview]
Message-ID: <20261118160146.60429-2-jakub.kulik@oracle.com> (raw)
In-Reply-To: <xmqqcxs9j1bp.fsf@gitster.g>

POSIX specifies that uname(2) can return any non-negative value on
success. Update the get_uname_info() check to follow this.

Signed-off-by: Jakub Kulik <jakub.kulik@oracle.com>
---
Thank you. Hope this is how it should look.

 version.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/version.c b/version.c
index 21ec7c0fbe..ca3be6d610 100644
--- a/version.c
+++ b/version.c
@@ -83,7 +83,7 @@ int get_uname_info(struct strbuf *buf, unsigned int full)
 {
 	struct utsname uname_info;
 
-	if (uname(&uname_info)) {
+	if (uname(&uname_info) < 0) {
 		strbuf_addf(buf, _("uname() failed with error '%s' (%d)\n"),
 			    strerror(errno),
 			    errno);
-- 
2.50.1


  reply	other threads:[~2026-11-18 16:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 15:52 uname check fails on Solaris due to different return value Jakub Kulik
2026-11-12 19:29 ` Junio C Hamano
2026-11-18 16:01   ` Jakub Kulik [this message]
2026-11-18 17:11     ` [PATCH] version: accept positive uname(2) return values Junio C Hamano

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

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

  git send-email \
    --in-reply-to=20261118160146.60429-2-jakub.kulik@oracle.com \
    --to=jakub.kulik@oracle.com \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox