From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C6yhm-0003H3-TV for qemu-devel@nongnu.org; Mon, 13 Sep 2004 17:49:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C6yhl-0003GW-Ua for qemu-devel@nongnu.org; Mon, 13 Sep 2004 17:49:46 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C6yhl-0003GM-QT for qemu-devel@nongnu.org; Mon, 13 Sep 2004 17:49:45 -0400 Received: from [129.104.30.34] (helo=a.mx.polytechnique.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C6ybU-0001QJ-U1 for qemu-devel@nongnu.org; Mon, 13 Sep 2004 17:43:18 -0400 Received: from localhost (localhost [127.0.0.1]) by djali.m4x.org (Postfix) with ESMTP id 18396331BD for ; Mon, 13 Sep 2004 23:43:15 +0200 (CEST) Received: from djali.m4x.org ([127.0.0.1]) by localhost (djali [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 15201-10 for ; Mon, 13 Sep 2004 23:43:15 +0200 (CEST) Received: from bellard.org (nas-cbv-5-213-228-50-7.dial.proxad.net [213.228.50.7]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTP id D252733173 for ; Mon, 13 Sep 2004 23:43:13 +0200 (CEST) Message-ID: <414610F1.7040402@bellard.org> Date: Mon, 13 Sep 2004 23:28:17 +0200 From: Fabrice Bellard MIME-Version: 1.0 Subject: Re: [Qemu-devel] [patch] Bug in path.c References: <200409111817.43335.paul@codesourcery.com> In-Reply-To: <200409111817.43335.paul@codesourcery.com> Content-Type: text/plain; charset=us-ascii; 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 applied. Fabrice. Paul Brook wrote: > The path mangling code does the wrong thing when the prefix doesn't exist. > For example path("/.") still returns "/usr/gnemul/qemu-arm", even if the > latter doesn't exist (commonly the case when using a chroot). > > Patch below fixes this by setting base to NULL if the prefix contains no > files. > > Paul > > Index: path.c > =================================================================== > RCS file: /cvsroot/qemu/qemu/linux-user/path.c,v > retrieving revision 1.1 > diff -u -p -r1.1 path.c > --- path.c 11 Apr 2003 00:15:13 -0000 1.1 > +++ path.c 11 Sep 2004 17:12:14 -0000 > @@ -101,7 +101,11 @@ void init_paths(const char *prefix) > > base = new_entry("", NULL, prefix+1); > base = add_dir_maybe(base); > - set_parents(base, base); > + if (base->num_entries == 0) { > + free (base); > + base = NULL; > + } else > + set_parents(base, base); > } > > /* FIXME: Doesn't handle DIR/.. where DIR is not in emulated dir. */ > > > _______________________________________________ > Qemu-devel mailing list > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel > >