From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXtIg-0005Pz-1w for qemu-devel@nongnu.org; Fri, 25 May 2012 08:07:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXtIb-0000uB-5y for qemu-devel@nongnu.org; Fri, 25 May 2012 08:07:21 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:51994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXtIa-0000sv-UX for qemu-devel@nongnu.org; Fri, 25 May 2012 08:07:17 -0400 From: Peter Maydell Date: Fri, 25 May 2012 13:07:01 +0100 Message-Id: <1337947621-8610-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH] qemu_find_file: check name as a straight path even if it has no '/' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , patches@linaro.org Make qemu_find_file() check for the passed in name as a straight pathname even if it doesn't have any path separator character in it. This means that "-bios foo", "-dtb foo" etc will find a file 'foo' in the current directory. This removes an inconsistency with -kernel and -initrd, which both accept plain filenames as meaning files in the current directory. It's also less confusing for the user than an undocumented restriction that "this option accepts a filename, except for the special case where the filename you pass happens not to have a '/' in it, in which case we'll ignore it." Signed-off-by: Peter Maydell --- vl.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/vl.c b/vl.c index 23ab3a3..4639526 100644 --- a/vl.c +++ b/vl.c @@ -1801,9 +1801,8 @@ char *qemu_find_file(int type, const char *name) const char *subdir; char *buf; - /* If name contains path separators then try it as a straight path. */ - if ((strchr(name, '/') || strchr(name, '\\')) - && access(name, R_OK) == 0) { + /* Try the name as a straight path first */ + if (access(name, R_OK) == 0) { return g_strdup(name); } switch (type) { -- 1.7.1