|
From: | Anthony Liguori |
Subject: | Re: [Qemu-devel] [PATCH] Introduce get_datafile_dir() to replace bios_dir |
Date: | Thu, 26 Feb 2009 10:37:36 -0600 |
User-agent: | Thunderbird 2.0.0.19 (X11/20090105) |
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
[Prev in Thread] | Current Thread | [Next in Thread] |