From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LFAxe-0003PE-RD for qemu-devel@nongnu.org; Tue, 23 Dec 2008 12:22:26 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LFAxc-0003O6-VG for qemu-devel@nongnu.org; Tue, 23 Dec 2008 12:22:26 -0500 Received: from [199.232.76.173] (port=57768 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LFAxc-0003O3-NO for qemu-devel@nongnu.org; Tue, 23 Dec 2008 12:22:24 -0500 Received: from mail-bw0-f12.google.com ([209.85.218.12]:65363) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LFAxc-00088o-6s for qemu-devel@nongnu.org; Tue, 23 Dec 2008 12:22:24 -0500 Received: by bwz5 with SMTP id 5so396942bwz.10 for ; Tue, 23 Dec 2008 09:22:22 -0800 (PST) Message-ID: Date: Tue, 23 Dec 2008 19:20:29 +0200 From: "Blue Swirl" Subject: Re: [Qemu-devel] [PATCH] add "serial" parameter to -drive flag In-Reply-To: <20081223163806.GA10805@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20081223132305.GA3435@redhat.com> <20081223163806.GA10805@redhat.com> 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 On 12/23/08, Gleb Natapov wrote: > On Tue, Dec 23, 2008 at 06:06:07PM +0200, Blue Swirl wrote: > > On 12/23/08, Gleb Natapov wrote: > > > Windows calculates HW "uniqueness" based on a hard drive serial number > > > among other things. The patch allows to specify drive serial number > > > from a command line. > > > > > > Signed-off-by: Gleb Natapov > > > > > - snprintf(buf, sizeof(buf), "QM%05d", s->drive_serial); > > > > > - snprintf(buf, sizeof(buf), "QM%05d", s->drive_serial); > > > > > - snprintf(buf, sizeof(buf), "QM%05d", s->drive_serial); > > > > > + sprintf(s->drive_serial_str, "QM%05d", s->drive_serial); > > > > You better watch out, this degrades snprintf to sprintf. > > > > I can use snprintf, but in this case we know exactly the length of the > resulting string. True, but OpenBSD linker issues warnings when sprintf and friends are used.