From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDGEM-0007CP-EZ for qemu-devel@nongnu.org; Wed, 15 Jun 2016 15:12:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDGEI-0001Uv-Ml for qemu-devel@nongnu.org; Wed, 15 Jun 2016 15:12:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDGEI-0001Uf-EM for qemu-devel@nongnu.org; Wed, 15 Jun 2016 15:11:58 -0400 References: <1466011636-6112-1-git-send-email-armbru@redhat.com> <1466011636-6112-4-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <5761A87C.1030600@redhat.com> Date: Wed, 15 Jun 2016 13:11:56 -0600 MIME-Version: 1.0 In-Reply-To: <1466011636-6112-4-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ek5f4rRTMsSvOB31oLiSTjTwB1UuRrtjl" Subject: Re: [Qemu-devel] [PATCH 3/3] log: Fix qemu_set_log_filename() error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, alex.bennee@linaro.org, "Denis V. Lunev" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ek5f4rRTMsSvOB31oLiSTjTwB1UuRrtjl Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/15/2016 11:27 AM, Markus Armbruster wrote: > When qemu_set_log_filename() detects an invalid file name, it reports > an error, closes the log file (if any), and starts logging to stderr > (unless daemonized or nothing is being logged). >=20 > This is wrong. Asking for an invalid log file on the command line > should be fatal. Asking for one in the monitor should fail without > messing up an existing logfile. >=20 > Fix by converting qemu_set_log_filename() to Error. Pass it > &error_fatal, except for hmp_logfile report errors. >=20 > This also permits testing without a subprocess, so do that. >=20 > Signed-off-by: Markus Armbruster > --- > bsd-user/main.c | 3 ++- > include/qemu/log.h | 2 +- > linux-user/main.c | 3 ++- > monitor.c | 7 ++++++- > tests/test-logging.c | 41 ++++++++--------------------------------- > trace/control.c | 3 ++- > util/log.c | 6 +++--- > vl.c | 2 +- > 8 files changed, 25 insertions(+), 42 deletions(-) >=20 > diff --git a/bsd-user/main.c b/bsd-user/main.c > index 9f592be..3d6a4f4 100644 > --- a/bsd-user/main.c > +++ b/bsd-user/main.c > @@ -20,6 +20,7 @@ > #include > #include > =20 > +#include "qapi/error.h" > #include "qemu.h" > #include "qemu/path.h" > #include "qemu/help_option.h" > @@ -848,7 +849,7 @@ int main(int argc, char **argv) > =20 > /* init debug */ > qemu_log_needs_buffers(); > - qemu_set_log_filename(log_file); > + qemu_set_log_filename(log_file, &error_fatal); Commit race between this patch and Denis' series: https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg00515.html Whoever goes in second will have a build failure until all the new uses are also converted. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --ek5f4rRTMsSvOB31oLiSTjTwB1UuRrtjl Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXYah8AAoJEKeha0olJ0Nq2+AH/1oLUO4GHeqRoYL75Tm0zFGo aHLULxq2gCP4M1n/K/hR6z4Peq45P3M++YOawYBmwD1P8Hi7ANJUtHI84Z5jV/5J cWmnZ2Th8nSQAk1xJSegj883vIRaNxGsvx7eNuclTJai6iKCZ9mRMaL8jnPI+FRk fkGUTA0IpIW6MSn2YJefvQi4LJo2bFhbGDQbt1WbWL2b/jm2h/vtsMgqVtKpfXvT Xgxp139S2yspQyXgrdPSleEeSYwpHcxgk/kPfOY9wQZ24TJTA8cGOzwQ7UA3+Hsr H0x0DeFkPAXCdd+PzsVvygiE/0zcsO/AmJ/X0OooqeDvpt6xU93aN+TT4tFi7OA= =MGKi -----END PGP SIGNATURE----- --ek5f4rRTMsSvOB31oLiSTjTwB1UuRrtjl--