From: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
To: "Ruffalo Lavoisier" <ruffalolavoisier@gmail.com>
Cc: "Stephan Beyer" <s-beyer@gmx.net>,
"Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
git@vger.kernel.org
Subject: Re: [PATCH] am: fix condition check on fseek
Date: Sat, 21 Sep 2024 21:52:50 +0200 [thread overview]
Message-ID: <7601dcef-e256-4e20-bbd4-75955e5a45d5@app.fastmail.com> (raw)
In-Reply-To: <20240921150855.31574-1-RuffaloLavoisier@gmail.com>
On Sat, Sep 21, 2024, at 17:08, Ruffalo Lavoisier wrote:
> if fseek() is success, return value is 0
>
> Signed-off-by: Ruffalo Lavoisier <RuffaloLavoisier@gmail.com>
> ---
> builtin/am.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/am.c b/builtin/am.c
> index d8875ad402..a7727fd4ea 100644
> --- a/builtin/am.c
> +++ b/builtin/am.c
> @@ -589,7 +589,7 @@ static int is_mail(FILE *fp)
> regex_t regex;
> int ret = 1;
>
> - if (fseek(fp, 0L, SEEK_SET))
> + if (!fseek(fp, 0L, SEEK_SET))
> die_errno(_("fseek failed"));
>
> if (regcomp(®ex, header_regex, REG_NOSUB | REG_EXTENDED))
> --
> 2.46.1
I don’t get this change? The function returns false on success. true if
it fails (not zero). You want the program to die if it returns non-zero.
It’s hard to wrap my head around… “false must mean “no errors” ”
If the original code has a bug then I don’t see how git-am(1) could work
considering it presumably always checks ‘is_mail’.
--
Kristoffer
next prev parent reply other threads:[~2024-09-21 19:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-21 15:08 [PATCH] am: fix condition check on fseek Ruffalo Lavoisier
2024-09-21 19:52 ` Kristoffer Haugsbakk [this message]
2024-09-23 16:43 ` 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=7601dcef-e256-4e20-bbd4-75955e5a45d5@app.fastmail.com \
--to=kristofferhaugsbakk@fastmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=ruffalolavoisier@gmail.com \
--cc=s-beyer@gmx.net \
/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;
as well as URLs for NNTP newsgroup(s).