summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Merey <amerey@redhat.com>2022-11-07 11:26:32 -0500
committerAaron Merey <amerey@redhat.com>2022-11-07 11:26:32 -0500
commit88bab837c1d96a1f9a589dca74101ff378a0ff65 (patch)
tree0c8b34f03ae4e3dbfe8c99db89c6338700f1928a
parent4628be9e03db78eaf2b02e9aa6cc677a0b4319ea (diff)
downloadelfutils-88bab837c1d96a1f9a589dca74101ff378a0ff65.tar.gz
debuginfod-client.c: Don't treat 0 as an error code.
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>
-rw-r--r--debuginfod/ChangeLog5
-rw-r--r--debuginfod/debuginfod-client.c4
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);