* [Qemu-devel] [patch] Bug in path.c
@ 2004-09-11 17:17 Paul Brook
2004-09-13 21:28 ` Fabrice Bellard
0 siblings, 1 reply; 2+ messages in thread
From: Paul Brook @ 2004-09-11 17:17 UTC (permalink / raw)
To: qemu-devel
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. */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [patch] Bug in path.c
2004-09-11 17:17 [Qemu-devel] [patch] Bug in path.c Paul Brook
@ 2004-09-13 21:28 ` Fabrice Bellard
0 siblings, 0 replies; 2+ messages in thread
From: Fabrice Bellard @ 2004-09-13 21:28 UTC (permalink / raw)
To: qemu-devel
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
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-09-13 21:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-11 17:17 [Qemu-devel] [patch] Bug in path.c Paul Brook
2004-09-13 21:28 ` Fabrice Bellard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).