From patchwork Mon Nov 7 16:32:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 60135 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 07D0C3858407 for ; Mon, 7 Nov 2022 16:33:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 07D0C3858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667838781; bh=x7vBlF42Oll/hCuxfBWExbNxvvFavAKClGQHbJLO11E=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Help:List-Subscribe:From:Reply-To:From; b=B//BLAWs36NcGfq9sJhv6N/oxiOUNagZX9NoMkHW83T4lrS9zDtUU9vTy9pAdY6Z6 VTPv0km9DQ2oa0omtLUjtsoVzFHUUtBKgu0Z/BZPoA1dZg3k3Hc4ULrXrSkxL1u28+ ahK2B5PD4WwZJ/9/odI4FMaN+GukTAjmMD9MMSV0= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 0B9693858D28 for ; Mon, 7 Nov 2022 16:32:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0B9693858D28 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-435-kc5ungK8PxmtNMyqAl4dMA-1; Mon, 07 Nov 2022 11:32:13 -0500 X-MC-Unique: kc5ungK8PxmtNMyqAl4dMA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE9853800C21 for ; Mon, 7 Nov 2022 16:32:12 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.16.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id A189C140EBF5; Mon, 7 Nov 2022 16:32:12 +0000 (UTC) To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [COMMITTED] debuginfod-client.c: Don't treat 0 as an error code. Date: Mon, 7 Nov 2022 11:32:11 -0500 Message-Id: <20221107163211.10504-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Aaron Merey via Elfutils-devel From: Aaron Merey Reply-To: Aaron Merey Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Replace 'fd > 0' with 'fd >= 0' to avoid treating a possible file descriptor as an error code. Signed-off-by: Aaron Merey --- 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 + + * debuginfod-client.c (debuginfod_find_section): Don't treat 0 as an + error code. + 2022-11-04 Aaron Merey * 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);