From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9rgp-0007I5-Kk for qemu-devel@nongnu.org; Tue, 09 Oct 2018 09:04:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9rgi-0003Fw-LS for qemu-devel@nongnu.org; Tue, 09 Oct 2018 09:04:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60542) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g9rgf-00039n-Kj for qemu-devel@nongnu.org; Tue, 09 Oct 2018 09:04:36 -0400 From: Markus Armbruster References: <1539052760-11730-1-git-send-email-liq3ea@gmail.com> <7a26945a-d94f-98db-7ae2-0d4c089ab975@redhat.com> Date: Tue, 09 Oct 2018 15:04:26 +0200 In-Reply-To: (Li Qiang's message of "Tue, 9 Oct 2018 13:58:21 +0800") Message-ID: <87bm83uv8l.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2] vl.c: print error message if load fw_cfg file failed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Li Qiang Cc: philmd@redhat.com, Paolo Bonzini , f4bug@amsat.org, Qemu Developers Li Qiang writes: > Hello Philippe, > > Philippe Mathieu-Daud=C3=A9 =E4=BA=8E2018=E5=B9=B410= =E6=9C=889=E6=97=A5=E5=91=A8=E4=BA=8C =E4=B8=8B=E5=8D=881:52=E5=86=99=E9=81= =93=EF=BC=9A > >> Hi Li, >> >> On 09/10/2018 04:39, Li Qiang wrote: >> > It makes sense to print the error message while reading >> > file failed. [...] >> > diff --git a/vl.c b/vl.c >> > index 4e25c78..69fc77c 100644 >> > --- a/vl.c >> > +++ b/vl.c >> > @@ -2207,8 +2207,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts = *opts, Error **errp) >> > size =3D strlen(str); /* NUL terminator NOT included in fw_cf= g blob */ >> > buf =3D g_memdup(str, size); >> > } else { >> > - if (!g_file_get_contents(file, &buf, &size, NULL)) { >> > - error_report("can't load %s", file); >> > + GError *error =3D NULL; >> > + if (!g_file_get_contents(file, &buf, &size, &error)) { >> > + error_report("can't load %s, %s", file, error->message); >> >> If you ever respin, you can help Markus [1] effort using: >> >> error_setg(errp, "can't load %s, %s", file, error->message); >> >> Else your patch will clash with [2]. >> > > OK, I will send out this patch based Markus' tree or later when his patch > goes to upstream. Appreciated!