From nobody Thu May 2 11:18:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 15410520650671.7873028595025744; Wed, 31 Oct 2018 23:01:05 -0700 (PDT) Received: from localhost ([::1]:35513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gI629-0000ai-Ua for importer@patchew.org; Thu, 01 Nov 2018 02:00:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gI61A-0000Cz-C5 for qemu-devel@nongnu.org; Thu, 01 Nov 2018 01:59:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gI617-00040w-72 for qemu-devel@nongnu.org; Thu, 01 Nov 2018 01:59:44 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:35662) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gI616-0003z6-W6 for qemu-devel@nongnu.org; Thu, 01 Nov 2018 01:59:41 -0400 Received: by mail-pf1-x441.google.com with SMTP id z2-v6so6202350pfe.2 for ; Wed, 31 Oct 2018 22:59:39 -0700 (PDT) Received: from localhost.localdomain.localdomain ([103.65.40.100]) by smtp.gmail.com with ESMTPSA id v83-v6sm56519130pfa.103.2018.10.31.22.59.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Oct 2018 22:59:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=TOOT3H+TDP41fIJgw2tvvTEwEnMMmP6vwkv56lTGqpQ=; b=WfktqApR332lk3Z1fmPaKmQnPjFmRgJ+pIUjd6N6BkbhzYzjkhlKWft4BX4pEE+plA T+F4hfHRSc6HzpFtGgkAc63qU14eII7fn+VSZfe28NMcQp+XwFKriLN3yGFVoV8etwj/ 2lp13tJXjCV11pgVj+WQi4olWqNUOPz0IRTPk7B9YkSNpT2ne1h2tDozrqix3a4nIFfy 1X/cypTgmffKn5ZqYLj/bjE/JcG3u2dxWOMje3pg+33ULR6XCms4tM/LC6ERHoiAW63t qEmCHtwbrEJd7TbM46guLsOqRhzsQo/67oaOS7D069Y0SbfbnZUUHOc+Tm/CIvD01bFv ZdKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=TOOT3H+TDP41fIJgw2tvvTEwEnMMmP6vwkv56lTGqpQ=; b=IrbX2aKFGUIHacCONXv6FAIDCMu89NP+RScy58P6b7AmVIM1+kIRcUAHpp9+oxT8Hm bWGQ7KLCtj6GOqhppWq4Tsw447HZ50PvSPWeQuRUfBp2N3ltho3s2CJE+qbiY3AO/GB9 hZJmdbvQZSr0CRZzNoQBxbU/lmjMUynt0hnHOm5KAn4c6jfzQgVRCg6IDj3hHOAjhTOy xf02zGS/QrTnsfUP2ieQCmxkRCJjnh1uvBOVplx5bELb6fAEuHAKP1cH+O1hIfekSsi3 VsOo1InXB4akc70ZX3adPOaEOrctrFGysvijmpeRF0hSXM4Z+CJFavmv3lzo2COcJ5/Q 24vw== X-Gm-Message-State: AGRZ1gJxqrrQXf4RZcXtvazUyBDQqcOJ7WgHl0n0/4gVEW2gpn/e6t5+ y9q3YdptTZSaG0tOGuC9b3Y= X-Google-Smtp-Source: AJdET5ehtEhPSPKp7UjPxdPaea4u2/b27JRlRpFaoMBMu/baTy4AtUlZVBzfAC5/RmJtpW0fLA5JuA== X-Received: by 2002:a65:45c9:: with SMTP id m9-v6mr5930206pgr.212.1541051978565; Wed, 31 Oct 2018 22:59:38 -0700 (PDT) From: Li Qiang To: pbonzini@redhat.com, armbru@redhat.com, philmd@redhat.com Date: Wed, 31 Oct 2018 22:59:31 -0700 Message-Id: <1541051971-28584-1-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH] vl: Improve error message when we can't load fw_cfg from file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" parse_fw_cfg() reports "can't load" without further details. Get the details from g_file_get_contents(), and include them in the error message. Signed-off-by: Li Qiang --- vl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index 1fcacc5..f0bd899 100644 --- a/vl.c +++ b/vl.c @@ -2244,8 +2244,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts= , Error **errp) size =3D strlen(str); /* NUL terminator NOT included in fw_cfg blo= b */ buf =3D g_memdup(str, size); } else { - if (!g_file_get_contents(file, &buf, &size, NULL)) { - error_setg(errp, "can't load %s", file); + GError *err =3D NULL; + if (!g_file_get_contents(file, &buf, &size, &err)) { + error_setg(errp, "can't load %s: %s", file, err->message); + g_error_free(err); return -1; } } --=20 1.8.3.1