From patchwork Mon Mar 11 19:12:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779432 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690237wrt; Mon, 11 Mar 2024 12:22:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXsJLK3LuqhRDMrQEViMTPVBo2GV4oORtDkgge9zip2gm2nJY/QkMLT+EkPMmOse6aMegUfGn90/t1FAHD2r1NV X-Google-Smtp-Source: AGHT+IH07gA3bINpXIyF9qkKO+SapKuAfLln/1iCZvzW+pf0f/6hrt0S5pd9Kxj2TinIuwinzdN6 X-Received: by 2002:a67:ed0e:0:b0:473:24cf:f510 with SMTP id l14-20020a67ed0e000000b0047324cff510mr4308974vsp.6.1710184928793; Mon, 11 Mar 2024 12:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184928; cv=none; d=google.com; s=arc-20160816; b=r3mscmTHaiTWo7EIk+BcAHBOPz9yWqNypC9aAq5NqLo0WNsnWAGtYXsN7tnEGVogo1 Whz9+Y53nVF6vq8P+8MhcFhO3Lm/k5YhZRt85wDQIaIcGUYho2o6lnYOvKZIAMLnfBFQ vWtlxaFcHsd+ffgNO8ezJDbwadlXKFHxLv1Ri+p9S4/dHCrJOsWQodTR3CFwT8v0ciJz DE/cVRdJ3ax+FrrUwXEiixPYMmE9NcInIYhp2QEfFyLdcaUqDVSvDWEgCdo4J6e6G/yI dOcVp/Lcr4tGNo5uMJ/z9XPdwT5xqW6cktvnlRYTuLHQZMM/uwIlxlW97CxK776QX2Td 6X7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=fGBqfc2Yb7ffBuCcbEGM7TZH/G4A1wFOIdL+pttdZZw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=LfC5ZK0Vwg3U3ZoqdZg6dwi92h2njEc1q33bHd1rSwrxeTnDlKL9lxiGullqmWRyHe ci3/zlciHoJSyB4BKXBr3okIRpvYcQiAdSLvPfVT7AnPYRqr3mIQPNISZ9TE+lf/PW+w i6r5CKJgMPFfm1ZKNUnUnpYnaSwUXpaQMwQq2aIr9CtKmzNFeSxX9iDM1UMNJb2xeLvV 5b5fOgK95AWu1x3EeM3zgGzUr1AIe6OUya0SPhiZjNrqJekDwu4+cQHENz/DXjkKQjzQ RyXESoFL0HC+D1G2Z1eJnJYbkKxZc1Yrrt3ORdIxgU4nma+OBbF+T6Dh3A46YJ3Ugrq5 H6nA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=la+fglUH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 12-20020a056214202c00b006903099b236si6142108qvf.504.2024.03.11.12.22.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:22:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=la+fglUH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl7x-0005TM-Tc; Mon, 11 Mar 2024 15:16:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjl4s-0003MA-Oa for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:54 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4q-0000MK-MD for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:50 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4132600824bso9416795e9.2 for ; Mon, 11 Mar 2024 12:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184366; x=1710789166; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=fGBqfc2Yb7ffBuCcbEGM7TZH/G4A1wFOIdL+pttdZZw=; b=la+fglUHuly6Hdv0x5TRg5v5Zo5+EQ18+7gga57ztCuVg1Co55kNDC0yWNnEgOARCm JIQaJeJWu2EvmmGk4ednb1teA2VSA/k0QO0uTeF5CbLoU7YPR27zX3+KdhMou5//x7S0 1tuAI9HH4jwlCEe7QLTH4vm3PzSZKq3UnC2WWVqbuaULfeoIXhc1Avn6TwevH9CwD+kx ytDOIXiI5lSWgIPeqYfRy+SD/sFC33AvH6SfhRiQcBPCCOM1bpC7Fs4NV0M1IecVw0Q9 okqmf1VcZBc+g7Cu/xt8bFosbnR/uur6GGoGN8nKVwbRaISTzvlyGq0fmrt6A+luwuhL NzzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184366; x=1710789166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fGBqfc2Yb7ffBuCcbEGM7TZH/G4A1wFOIdL+pttdZZw=; b=qLkKf0nafrE2dpR3a/s34zPB4x/CVajpzV2cf5pgl+3ivpIffKnDj9ZaSqMDZ1ufpu 24R8WBSRE/BJVhHjP+/jwnMnp01VF9uUFkjyGjGeMkc1fAaF09iCsp+pvUcMvw6EMYjT F4+edbw6WTJJK1GgVUKIPovjEihGse1uprgXPThp/ucxuadHYhk2ukHHSYbn8FoznQze +wcu5JDp/ys/EnO5jqyvx4s76wa/IhagJCpDSu1bC7/wbORlGk4V8uV9AvzBtyE1vZ/7 NV3nr0cZzhQ289NtpLQMGkJ/c47pmlABx79ngQUGKonFKas6dzPokhxGWcUMxNn7nNz6 92sA== X-Gm-Message-State: AOJu0YyVreU2MjCPLJN9tgFm9nlXssNcg8ojzy/r+zKisZNUVQ6xYZbc KaAa7j4z/4rMNpVwqu1U1+Q/a41PnLFn+u7CDBtusrTsLIYXh11hed3pkx4O0wyrsJNeFG8HFTp n X-Received: by 2002:a05:600c:5116:b0:413:2e49:3e05 with SMTP id o22-20020a05600c511600b004132e493e05mr939809wms.12.1710184366242; Mon, 11 Mar 2024 12:12:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:45 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/20] contrib/elf2dmp: Fix error reporting style in download.c Date: Mon, 11 Mar 2024 19:12:28 +0000 Message-Id: <20240311191241.4177990-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki Tested-by: Viktor Prutyanov Reviewed-by: Peter Maydell Message-id: 20240307-elf2dmp-v4-6-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/download.h | 2 +- contrib/elf2dmp/download.c | 10 +++++----- contrib/elf2dmp/main.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/elf2dmp/download.h b/contrib/elf2dmp/download.h index 5c274925f7a..f65adb5d089 100644 --- a/contrib/elf2dmp/download.h +++ b/contrib/elf2dmp/download.h @@ -8,6 +8,6 @@ #ifndef DOWNLOAD_H #define DOWNLOAD_H -int download_url(const char *name, const char *url); +bool download_url(const char *name, const char *url); #endif /* DOWNLOAD_H */ diff --git a/contrib/elf2dmp/download.c b/contrib/elf2dmp/download.c index 902dc04ffa5..21306b3fd4c 100644 --- a/contrib/elf2dmp/download.c +++ b/contrib/elf2dmp/download.c @@ -9,14 +9,14 @@ #include #include "download.h" -int download_url(const char *name, const char *url) +bool download_url(const char *name, const char *url) { - int err = 1; + bool success = false; FILE *file; CURL *curl = curl_easy_init(); if (!curl) { - return 1; + return false; } file = fopen(name, "wb"); @@ -33,11 +33,11 @@ int download_url(const char *name, const char *url) unlink(name); fclose(file); } else { - err = fclose(file); + success = !fclose(file); } out_curl: curl_easy_cleanup(curl); - return err; + return success; } diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 09af39422f1..d295fd92be2 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -591,7 +591,7 @@ int main(int argc, char *argv[]) sprintf(pdb_url, "%s%s/%s/%s", SYM_URL_BASE, PDB_NAME, pdb_hash, PDB_NAME); printf("PDB URL is %s\n", pdb_url); - if (download_url(PDB_NAME, pdb_url)) { + if (!download_url(PDB_NAME, pdb_url)) { eprintf("Failed to download PDB file\n"); goto out_ps; }