From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D31133858421 for ; Fri, 4 Nov 2022 21:40:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D31133858421 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667598027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ggHeREvqSp4gXhTL0jKCdWO7ta3VbvqoC/iNrl0Ge1E=; b=NHSjyXQtCXaz0Aje5xd4U/rpwVBvLi5DqvZ7+8rM9iXyvNJZ3szebiyq6mJk4QRKcCnYsb KupSsUnufboW/3kJpK+ntpUvMoN6+9CVCkO5TkFPKCFo/RF7KlTSkuU0al6OcRUh8T2Z3P OMMQ1kqAsgU7Jj8CZkJm2hvN4PUJXUM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-158-o1-gkJPoPLyaIDbK3yBH4Q-1; Fri, 04 Nov 2022 17:40:26 -0400 X-MC-Unique: o1-gkJPoPLyaIDbK3yBH4Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 26A1585A5A6 for ; Fri, 4 Nov 2022 21:40:26 +0000 (UTC) Received: from localhost.localdomain (unknown [10.22.17.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB6EB492B0D; Fri, 4 Nov 2022 21:40:25 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [COMMITTED] debuginfod_find_section: Always update rc with most recent error code Date: Fri, 4 Nov 2022 17:40:18 -0400 Message-Id: <20221104214018.718373-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 --- debuginfod/ChangeLog | 5 +++++ debuginfod/debuginfod-client.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 4d576cae..5678002a 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,8 @@ +2022-11-04 Aaron Merey + + * debuginfod-client.c (debuginfod_find_section): Ensure rc + is always updated with the most recent error code. + 2022-11-03 Frank Ch. Eigler * debuginfod.cxx (handle_buildid): Correctly manage lifetime diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index f48e32cc..99da05ef 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1944,7 +1944,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) @@ -1952,6 +1953,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); -- 2.37.3