git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Elijah Newren <newren@gmail.com>
Cc: Jeff King <peff@peff.net>,
	"Randall S. Becker" <rsbecker@nexbridge.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] compat-util: pretend that stub setitimer() always succeeds
Date: Tue, 15 Dec 2020 13:26:17 -0800	[thread overview]
Message-ID: <xmqqpn3a7ocm.fsf_-_@gitster.c.googlers.com> (raw)
In-Reply-To: <xmqqzh2e7p6l.fsf@gitster.c.googlers.com> (Junio C. Hamano's message of "Tue, 15 Dec 2020 13:08:18 -0800")

When 15b52a44 (compat-util: type-check parameters of no-op
replacement functions, 2020-08-06) turned a handful of no-op
C-preprocessor macros into static inline functions to give the
callers a better type checking for their parameters, it forgot
to return anything from the stubbed out setitimer() function,
even though the function was defined to return an int just like the
real thing.

Since the original C-preprocessor macro implementation was to just
turn the call to the function an empty statement, we know that the
existing callers do not check the return value from it, and it does
not matter what value we return.  But it is safer to pretend that
the call succeeded by returning 0 than making it fail by returning -1
and clobbering errno with some value.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-compat-util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 7a0fb7a045..421c90b5d8 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -273,7 +273,7 @@ struct itimerval {
 
 #ifdef NO_SETITIMER
 static inline int setitimer(int which, const struct itimerval *value, struct itimerval *newvalue) {
-	; /* nothing */
+	return 0; /* pretend success */
 }
 #endif
 
-- 
2.30.0-rc0-186-g20447144ec


  parent reply	other threads:[~2020-12-15 21:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 23:12 [ANNOUNCE] git-2.30.0-rc0 - Compile Fails on HPE NonStop Randall S. Becker
2020-12-15  2:43 ` Junio C Hamano
2020-12-15  2:52   ` Jeff King
2020-12-15 15:55     ` Randall S. Becker
2020-12-15 16:21     ` Elijah Newren
2020-12-15 21:07       ` Junio C Hamano
2020-12-15 21:08       ` Junio C Hamano
2020-12-15 21:25         ` [PATCH] strmap: make callers of strmap_remove() to call it in void context Junio C Hamano
2020-12-15 21:35           ` Randall S. Becker
2020-12-15 21:26         ` Junio C Hamano [this message]
2020-12-15 21:37         ` [ANNOUNCE] git-2.30.0-rc0 - Compile Fails on HPE NonStop Jeff King
2020-12-16 17:27           ` 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

  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=xmqqpn3a7ocm.fsf_-_@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=rsbecker@nexbridge.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).