From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LcjWN-0001Dv-MI for qemu-devel@nongnu.org; Thu, 26 Feb 2009 11:55:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LcjWM-0001D4-7l for qemu-devel@nongnu.org; Thu, 26 Feb 2009 11:55:39 -0500 Received: from [199.232.76.173] (port=50953 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LcjWM-0001Cw-0w for qemu-devel@nongnu.org; Thu, 26 Feb 2009 11:55:38 -0500 Received: from bsdimp.com ([199.45.160.85]:52367 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 1LcjWL-0000lk-HT for qemu-devel@nongnu.org; Thu, 26 Feb 2009 11:55:37 -0500 Date: Thu, 26 Feb 2009 09:53:46 -0700 (MST) Message-Id: <20090226.095346.-658329428.imp@bsdimp.com> Subject: Re: [Qemu-devel] [PATCH] Introduce get_datafile_dir() to replace bios_dir From: "M. Warner Losh" In-Reply-To: <49A6C550.7070005@us.ibm.com> References: <1234695809-14967-1-git-send-email-amit.shah@redhat.com> <49A6C550.7070005@us.ibm.com> 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, aliguori@us.ibm.com Cc: amit.shah@redhat.com In message: <49A6C550.7070005@us.ibm.com> Anthony Liguori writes: : 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(). Better performance to, but I doubt that would matter here... Warner