From patchwork Mon May 9 15:40:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 53669 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 6ED763888833 for ; Mon, 9 May 2022 15:40:51 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id A69C23948810 for ; Mon, 9 May 2022 15:40:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A69C23948810 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from tarox.wildebeest.org (83-87-18-245.cable.dynamic.v4.ziggo.nl [83.87.18.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 6A0943000599; Mon, 9 May 2022 17:40:41 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 3090C4050E8C; Mon, 9 May 2022 17:40:41 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Subject: [PATCHv2] debuginfod: Check result of curl_easy_getinfo in debuginfod_write_callback Date: Mon, 9 May 2022 17:40:39 +0200 Message-Id: <20220509154039.8014-1-mark@klomp.org> X-Mailer: git-send-email 2.18.4 X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Cc: Mark Wielaard Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" This was the only place in debuginfod-client.c where we didn't check the result of curl_easy_getinfo. Just check it to make things consistent. Signed-off-by: Mark Wielaard --- v2 This time with the actual code change... debuginfod/ChangeLog | 5 +++++ debuginfod/debuginfod-client.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 619ebd8c..91890786 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,8 @@ +2022-05-09 Mark Wielaard + + * debuginfod-client.c (debuginfod_write_callback): Check result + of curl_easy_getinfo. + 2022-05-04 Frank Ch. Eigler Mark Wielaard diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index 521972e4..882a809a 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -213,8 +213,9 @@ debuginfod_write_callback (char *ptr, size_t size, size_t nmemb, void *data) *d->target_handle = d->handle; /* update the client object */ const char *url = NULL; - (void) curl_easy_getinfo (d->handle, CURLINFO_EFFECTIVE_URL, &url); - if (url) + CURLcode curl_res = curl_easy_getinfo (d->handle, + CURLINFO_EFFECTIVE_URL, &url); + if (curl_res == CURLE_OK && url) { free (d->client->url); d->client->url = strdup(url); /* ok if fails */