From patchwork Mon Jun 7 23:51:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 54897 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E6BAAB7D4F for ; Tue, 8 Jun 2010 09:53:54 +1000 (EST) Received: from localhost ([127.0.0.1]:48680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLm8e-0004NW-6V for incoming@patchwork.ozlabs.org; Mon, 07 Jun 2010 19:53:52 -0400 Received: from [140.186.70.92] (port=43857 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLm7A-0004KF-T0 for qemu-devel@nongnu.org; Mon, 07 Jun 2010 19:52:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OLm78-00038V-Lz for qemu-devel@nongnu.org; Mon, 07 Jun 2010 19:52:20 -0400 Received: from e4.ny.us.ibm.com ([32.97.182.144]:37340) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLm78-00037x-Es for qemu-devel@nongnu.org; Mon, 07 Jun 2010 19:52:18 -0400 Received: from d01relay06.pok.ibm.com (d01relay06.pok.ibm.com [9.56.227.116]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o57Nd8qB009663 for ; Mon, 7 Jun 2010 19:39:08 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o57NqFOP1388760 for ; Mon, 7 Jun 2010 19:52:15 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o57NqEhu010017 for ; Mon, 7 Jun 2010 20:52:14 -0300 Received: from localhost.localdomain (sig-9-65-84-205.mts.ibm.com [9.65.84.205]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o57NqDqo009965; Mon, 7 Jun 2010 20:52:14 -0300 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Mon, 7 Jun 2010 18:51:49 -0500 Message-Id: <1275954730-8196-2-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1275954730-8196-1-git-send-email-aliguori@us.ibm.com> References: <1275954730-8196-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Glauber Costa , Anthony Liguori , Gerd Hoffman Subject: [Qemu-devel] [PATCH 01/22] QemuOpts: fix a bug in QemuOpts when setting an option twice X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Right now, if you set a QemuOpts option in a section twice, when you get the option you'll receive the value that was set the first time. This is less than ideal because if you're manipulating options in two places like a global config followed by the command line, you really want the later to override the former. This patch fixes this behavior. Signed-off-by: Anthony Liguori diff --git a/qemu-option.c b/qemu-option.c index acd74f9..e0cb91b 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -628,7 +628,7 @@ int qemu_opt_set(QemuOpts *opts, const char *name, const char *value) opt = qemu_mallocz(sizeof(*opt)); opt->name = qemu_strdup(name); opt->opts = opts; - QTAILQ_INSERT_TAIL(&opts->head, opt, next); + QTAILQ_INSERT_HEAD(&opts->head, opt, next); if (desc[i].name != NULL) { opt->desc = desc+i; }