From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LMq2Y-0003pS-Ec for qemu-devel@nongnu.org; Tue, 13 Jan 2009 15:39:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LMq2W-0003mJ-NX for qemu-devel@nongnu.org; Tue, 13 Jan 2009 15:39:09 -0500 Received: from [199.232.76.173] (port=47300 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMq2W-0003ls-GY for qemu-devel@nongnu.org; Tue, 13 Jan 2009 15:39:08 -0500 Received: from bsdimp.com ([199.45.160.85]:54920 helo=harmony.bsdimp.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LMq2W-0002oH-0f for qemu-devel@nongnu.org; Tue, 13 Jan 2009 15:39:08 -0500 Date: Tue, 13 Jan 2009 13:36:33 -0700 (MST) Message-Id: <20090113.133633.1649829323.imp@bsdimp.com> Subject: Re: [Qemu-devel] [6215] snapshot subcommand for qemu-img (Kevin Wolf) From: "M. Warner Losh" In-Reply-To: <496CE528.5090509@codemonkey.ws> References: <496CE528.5090509@codemonkey.ws> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, anthony@codemonkey.ws Cc: kwolf@suse.de In message: <496CE528.5090509@codemonkey.ws> Anthony Liguori writes: : Anthony Liguori wrote: : > +static void img_snapshot(int argc, char **argv) : > +{ : > + BlockDriverState *bs; : > + QEMUSnapshotInfo sn; : > + char *filename, *snapshot_name = NULL; : > + char c; : > + int ret; : > + int action = 0; : > + qemu_timeval tv; : > + : > + /* Parse commandline parameters */ : > + for(;;) { : > + c = getopt(argc, argv, "la:c:d:h"); : > + if (c == -1) : > + break; : > : : char's are not always signed so this code is incorrect. You should use : an int instead. Can you send another patch fixing this please? More importantly, getopt returns an 'int' not a 'signed char'. This means it can report values that can't be represented by a 'signed char'. Warner