summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Merey <amerey@redhat.com>2022-09-28 10:04:23 -0400
committerAaron Merey <amerey@redhat.com>2022-09-28 10:16:04 -0400
commit9891b6117b836b60830c03c0297d83597f319dbc (patch)
treea9a4e9fe69e45958fc30a6fe184d32353f0ea59a
parent0e1eda6f83694ca65612456562c99c703cf0361f (diff)
downloadelfutils-9891b6117b836b60830c03c0297d83597f319dbc.tar.gz
debuginfod-client: Ensure only negative error codes returned.
Switch a couple error codes from positive to negative so they aren't interpreted as file descriptors by the caller.
-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 680720ff..8fb65133 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2022-09-28 Aaron Merey <amerey@redhat.com>
+
+ * debuginfod-client.c (debuginfod_query_server): Switch sign of some
+ error codes from positive to negative.
+
2022-09-08 Frank Ch. Eigler <fche@redhat.com>
* debuginfod-client.c (debuginfod_query_server): Clear
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 28ad04c0..2a14d9d9 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1085,7 +1085,7 @@ debuginfod_query_server (debuginfod_client *c,
c->winning_headers = NULL;
if ( maxtime > 0 && clock_gettime(CLOCK_MONOTONIC_RAW, &start_time) == -1)
{
- rc = errno;
+ rc = -errno;
goto out2;
}
long delta = 0;
@@ -1096,7 +1096,7 @@ debuginfod_query_server (debuginfod_client *c,
{
if (clock_gettime(CLOCK_MONOTONIC_RAW, &cur_time) == -1)
{
- rc = errno;
+ rc = -errno;
goto out2;
}
delta = cur_time.tv_sec - start_time.tv_sec;