From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [patch] Bug in path.c
Date: Sat, 11 Sep 2004 18:17:43 +0100 [thread overview]
Message-ID: <200409111817.43335.paul@codesourcery.com> (raw)
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. */
next reply other threads:[~2004-09-11 17:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-11 17:17 Paul Brook [this message]
2004-09-13 21:28 ` [Qemu-devel] [patch] Bug in path.c Fabrice Bellard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200409111817.43335.paul@codesourcery.com \
--to=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).