From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh07t-0005HV-JM for qemu-devel@nongnu.org; Tue, 19 Jun 2012 11:13:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sh07n-0003o3-1G for qemu-devel@nongnu.org; Tue, 19 Jun 2012 11:13:53 -0400 Received: from mail-bk0-f45.google.com ([209.85.214.45]:41324) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh07m-0003lT-Qd for qemu-devel@nongnu.org; Tue, 19 Jun 2012 11:13:46 -0400 Received: by bkwj10 with SMTP id j10so5518744bkw.4 for ; Tue, 19 Jun 2012 08:13:44 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1337947621-8610-1-git-send-email-peter.maydell@linaro.org> References: <1337947621-8610-1-git-send-email-peter.maydell@linaro.org> Date: Tue, 19 Jun 2012 16:13:44 +0100 Message-ID: From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [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 Ping? (patch still applies cleanly to current master; patchwork URL http://patchwork.ozlabs.org/patch/161324/ ) -- PMM On 25 May 2012 13:07, Peter Maydell wrote: > 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 > --- > =C2=A0vl.c | =C2=A0 =C2=A05 ++--- > =C2=A01 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) > =C2=A0 =C2=A0 const char *subdir; > =C2=A0 =C2=A0 char *buf; > > - =C2=A0 =C2=A0/* If name contains path separators then try it as a strai= ght path. =C2=A0*/ > - =C2=A0 =C2=A0if ((strchr(name, '/') || strchr(name, '\\')) > - =C2=A0 =C2=A0 =C2=A0 =C2=A0&& access(name, R_OK) =3D=3D 0) { > + =C2=A0 =C2=A0/* Try the name as a straight path first */ > + =C2=A0 =C2=A0if (access(name, R_OK) =3D=3D 0) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 return g_strdup(name); > =C2=A0 =C2=A0 } > =C2=A0 =C2=A0 switch (type) { > -- > 1.7.1