diff options
author | Aaron Merey <amerey@redhat.com> | 2022-11-04 17:22:40 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@redhat.com> | 2023-04-07 11:25:54 -0400 |
commit | 09af4e719149654a00253a052cc2ce53eb9ef244 (patch) | |
tree | aa67246b35ef96598aaa81b906b19c3c1c4ee555 | |
parent | df1881737bc89b7f4b06f0b038cb6fcfd76c7cae (diff) | |
download | elfutils-09af4e719149654a00253a052cc2ce53eb9ef244.tar.gz |
debuginfod_find_section: Always update rc with most recent error code
debuginfod_find_section may attempt to download both the debuginfo
and executable matching the given build-id. If neither of these
files can be found, update rc to ensure that we always return an
accurate error code in this case.
Signed-off-by: Aaron Merey <amerey@redhat.com>
-rw-r--r-- | debuginfod/ChangeLog | 5 | ||||
-rw-r--r-- | debuginfod/debuginfod-client.c | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index ea363886..4a84b87e 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,8 @@ +2022-11-04 Aaron Merey <amerey@redhat.com> + + * debuginfod-client.c (debuginfod_find_section): Ensure rc + is always updated with the most recent error code. + 2022-11-02 Mark Wielaard <mark@klomp.org> * debuginfod-client.c (extract_section): Mark static. diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index 611da879..cc8c0d9a 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -2070,7 +2070,8 @@ debuginfod_find_section (debuginfod_client *client, if (rc == -EEXIST) { - /* The section should be found in the executable. */ + /* Either the debuginfo couldn't be found or the section should + be in the executable. */ fd = debuginfod_find_executable (client, build_id, build_id_len, &tmp_path); if (fd > 0) @@ -2078,6 +2079,9 @@ debuginfod_find_section (debuginfod_client *client, rc = extract_section (fd, section, tmp_path, path); close (fd); } + else + /* Update rc so that we return the most recent error code. */ + rc = fd; } free (tmp_path); |