From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LcjF3-00014u-7s for qemu-devel@nongnu.org; Thu, 26 Feb 2009 11:37:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LcjF0-00014h-SY for qemu-devel@nongnu.org; Thu, 26 Feb 2009 11:37:43 -0500 Received: from [199.232.76.173] (port=42484 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LcjF0-00014e-LD for qemu-devel@nongnu.org; Thu, 26 Feb 2009 11:37:42 -0500 Received: from e1.ny.us.ibm.com ([32.97.182.141]:44122) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LcjEz-0006aR-TY for qemu-devel@nongnu.org; Thu, 26 Feb 2009 11:37:42 -0500 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e1.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id n1QGZRGM025493 for ; Thu, 26 Feb 2009 11:35:27 -0500 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n1QGbbhe2269404 for ; Thu, 26 Feb 2009 11:37:37 -0500 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n1QGba2Q025844 for ; Thu, 26 Feb 2009 09:37:36 -0700 Message-ID: <49A6C550.7070005@us.ibm.com> Date: Thu, 26 Feb 2009 10:37:36 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Introduce get_datafile_dir() to replace bios_dir References: <1234695809-14967-1-git-send-email-amit.shah@redhat.com> In-Reply-To: <1234695809-14967-1-git-send-email-amit.shah@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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 Cc: Amit Shah Amit Shah wrote: > bios_dir really is $(PREFIX)/share/qemu/ (or the dir. specified by > -L). It currently stores some firmware images and keymaps, so the > name bios_dir is really a misnomer. > > Replace it with a helper, get_datafile_dir(). > > > +static void set_datafile_dir(const char *dir) > +{ > + strncpy(datafile_dir, dir, sizeof(datafile_dir) - 1); > + datafile_dir[sizeof(datafile_dir) - 1] = 0; > +} > While this is a safe usage of strncpy(), strncpy() has such weird semantics that it would be better to just use snprintf(). Regards, Anthony Liguori