All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ruffalo Lavoisier <ruffalolavoisier@gmail.com>
To: git@vger.kernel.org
Cc: Ruffalo Lavoisier <RuffaloLavoisier@gmail.com>,
	Stephan Beyer <s-beyer@gmx.net>,
	Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>
Subject: [PATCH] am: fix condition check on fseek
Date: Sun, 22 Sep 2024 00:08:55 +0900	[thread overview]
Message-ID: <20240921150855.31574-1-RuffaloLavoisier@gmail.com> (raw)

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(&regex, header_regex, REG_NOSUB | REG_EXTENDED))
-- 
2.46.1


             reply	other threads:[~2024-09-21 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-21 15:08 Ruffalo Lavoisier [this message]
2024-09-21 19:52 ` [PATCH] am: fix condition check on fseek Kristoffer Haugsbakk
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=20240921150855.31574-1-RuffaloLavoisier@gmail.com \
    --to=ruffalolavoisier@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.