From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MWpJE-00038j-4l for qemu-devel@nongnu.org; Fri, 31 Jul 2009 06:25:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MWpJ8-000368-IZ for qemu-devel@nongnu.org; Fri, 31 Jul 2009 06:25:54 -0400 Received: from [199.232.76.173] (port=47779 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MWpJ7-00035q-V3 for qemu-devel@nongnu.org; Fri, 31 Jul 2009 06:25:50 -0400 Received: from mx2.redhat.com ([66.187.237.31]:47168) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MWpJ7-0004kY-1J for qemu-devel@nongnu.org; Fri, 31 Jul 2009 06:25:49 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6VAPl57028378 for ; Fri, 31 Jul 2009 06:25:47 -0400 From: Gerd Hoffmann Date: Fri, 31 Jul 2009 12:25:33 +0200 Message-Id: <1249035941-4562-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1249035941-4562-1-git-send-email-kraxel@redhat.com> References: <1249035941-4562-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 02/10] QemuOpts: qemu_opts_parse: fix id= parsing List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann We can't use get_param_value(), it can't handle parameters without '=' in there. Examples not working because of that: -device foo,id=bar -device file=/path/image,format=qcow2,snapshot,id=disk0 Signed-off-by: Gerd Hoffmann --- qemu-option.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/qemu-option.c b/qemu-option.c index 7164ee8..61141e0 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -715,8 +715,13 @@ QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, const char *fi QemuOpts *opts; const char *p,*pe,*pc; - if (get_param_value(value, sizeof(value), "id", params)) + if (strncmp(params, "id=", 3) == 0) { + get_opt_value(value, sizeof(value), params+3); id = qemu_strdup(value); + } else if ((p = strstr(params, ",id=")) != NULL) { + get_opt_value(value, sizeof(value), p+4); + id = qemu_strdup(value); + } opts = qemu_opts_create(list, id, 1); if (opts == NULL) return NULL; -- 1.6.2.5