From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NHfMk-00084a-Ae for qemu-devel@nongnu.org; Mon, 07 Dec 2009 10:19:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NHfMf-0007xs-CB for qemu-devel@nongnu.org; Mon, 07 Dec 2009 10:19:09 -0500 Received: from [199.232.76.173] (port=60723 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHfMf-0007xh-7y for qemu-devel@nongnu.org; Mon, 07 Dec 2009 10:19:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34707) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NHfMf-0000uV-BA for qemu-devel@nongnu.org; Mon, 07 Dec 2009 10:19:05 -0500 Message-ID: <4B1D1CE3.80905@redhat.com> Date: Mon, 07 Dec 2009 16:18:59 +0100 From: Gerd Hoffmann MIME-Version: 1.0 References: <1260189773-20728-1-git-send-email-kraxel@redhat.com> <1260189773-20728-18-git-send-email-kraxel@redhat.com> <20091207125947.46562073@doriath> In-Reply-To: <20091207125947.46562073@doriath> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [FOR 0.12 PATCH v3 17/21] rework -monitor handling, switch to QemuOpts List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel@nongnu.org, agraf@suse.de On 12/07/09 15:59, Luiz Capitulino wrote: >> + chardev = qemu_opt_get(opts, "chardev"); >> + chr = qemu_chr_find(chardev); >> + if (chardev == NULL) { >> + fprintf(stderr, "chardev \"%s\" not found\n", chardev); >> + exit(1); >> + } > > We should check for NULL before calling qemu_chr_find(). No. qemu_chr_find() can deal with NULL just fine. We should check the return value (chr) instead though. When fixing that it prints the error message and exits as it should. Well, almost, because ... > The reason for the segfault is that the chardev 'monitor' is not found, > so qemu_chr_find() returns NULL, passing it down to: ... 'monitor' should be there, there is a default for the monitor device. Hmm, checking why ... cheers, Gerd