From patchwork Wed Sep 28 14:17:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 58111 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 E9B583857BA4 for ; Wed, 28 Sep 2022 14:18:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E9B583857BA4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664374686; bh=H4t4uNlXWuFO4Uxggkd9mx5drm4qBA9TvJtyQpkgwF4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=EQlOzMMJmMxb0G51+q9PkkcYk3EUwLgCOKwVf5UUTiK72cKzlhRrHpzNLqahAayfl YDi7iWPJjjsw+XNktVYM8KLKqS7ZopitHLUnll1dC9YfSucxA+txCyR4qTkUGsrSjO Dj2GnZIeFOwSOk6UnlkU4iCsvbcqmQjCrjBLnQGg= 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 144D93858016 for ; Wed, 28 Sep 2022 14:17:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 144D93858016 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-645-RjkQx73sPfCXFiWOt2WVXQ-1; Wed, 28 Sep 2022 10:17:55 -0400 X-MC-Unique: RjkQx73sPfCXFiWOt2WVXQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 24CB78027F5 for ; Wed, 28 Sep 2022 14:17:55 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.17.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFBFB7AE5; Wed, 28 Sep 2022 14:17:54 +0000 (UTC) To: elfutils-devel@sourceware.org Subject: [OB PATCH] debuginfod-client: Ensure only negative error codes returned. Date: Wed, 28 Sep 2022 10:17:53 -0400 Message-Id: <20220928141753.333722-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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_LOW, 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" Committing as obvious: Switch a couple error codes from positive to negative so they aren't interpreted as file descriptors by the caller. 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 680720ff..8fb65133 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,8 @@ +2022-09-28 Aaron Merey + + * debuginfod-client.c (debuginfod_query_server): Switch sign of some + error codes from positive to negative. + 2022-09-08 Frank Ch. Eigler * 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;