public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Aaron Merey <amerey@redhat.com>
To: elfutils-devel@sourceware.org
Cc: Aaron Merey <amerey@redhat.com>
Subject: [COMMITTED] debuginfod-client.c: Don't treat 0 as an error code.
Date: Mon,  7 Nov 2022 11:32:11 -0500	[thread overview]
Message-ID: <20221107163211.10504-1-amerey@redhat.com> (raw)

Replace 'fd > 0' with 'fd >= 0' to avoid treating a possible file
descriptor as an error code.

Signed-off-by: Aaron Merey <amerey@redhat.com>
---
 debuginfod/ChangeLog           | 5 +++++
 debuginfod/debuginfod-client.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 5678002a..a17bc5ab 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2022-11-07  Aaron Merey  <amerey@redhat.com>
+
+	* debuginfod-client.c (debuginfod_find_section): Don't treat 0 as an
+	error code.
+
 2022-11-04  Aaron Merey  <amerey@redhat.com>
 
 	* debuginfod-client.c (debuginfod_find_section): Ensure rc
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 99da05ef..f9f26fd5 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1936,7 +1936,7 @@ debuginfod_find_section (debuginfod_client *client,
 	}
       return -ENOENT;
     }
-  if (fd > 0)
+  if (fd >= 0)
     {
       rc = extract_section (fd, section, tmp_path, path);
       close (fd);
@@ -1948,7 +1948,7 @@ debuginfod_find_section (debuginfod_client *client,
 	 be in the executable.  */
       fd = debuginfod_find_executable (client, build_id,
 				       build_id_len, &tmp_path);
-      if (fd > 0)
+      if (fd >= 0)
 	{
 	  rc = extract_section (fd, section, tmp_path, path);
 	  close (fd);
-- 
2.37.3


                 reply	other threads:[~2022-11-07 16:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221107163211.10504-1-amerey@redhat.com \
    --to=amerey@redhat.com \
    --cc=elfutils-devel@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).