Allow relative paths for the interpreter prefix in linux-user emulation.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2984 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
e27f01ef24
commit
ffb04fcf08
|
@ -92,23 +92,6 @@ static void set_parents(struct pathelem *child, struct pathelem *parent)
|
||||||
set_parents(child->entries[i], child);
|
set_parents(child->entries[i], child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_paths(const char *prefix)
|
|
||||||
{
|
|
||||||
if (prefix[0] != '/' ||
|
|
||||||
prefix[0] == '\0' ||
|
|
||||||
!strcmp(prefix, "/"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
base = new_entry("", NULL, prefix+1);
|
|
||||||
base = add_dir_maybe(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. */
|
/* FIXME: Doesn't handle DIR/.. where DIR is not in emulated dir. */
|
||||||
static const char *
|
static const char *
|
||||||
follow_path(const struct pathelem *cursor, const char *name)
|
follow_path(const struct pathelem *cursor, const char *name)
|
||||||
|
@ -135,6 +118,35 @@ follow_path(const struct pathelem *cursor, const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_paths(const char *prefix)
|
||||||
|
{
|
||||||
|
char pref_buf[PATH_MAX];
|
||||||
|
|
||||||
|
if (prefix[0] == '\0' ||
|
||||||
|
!strcmp(prefix, "/"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (prefix[0] != '/') {
|
||||||
|
char *cwd = get_current_dir_name();
|
||||||
|
if (!cwd)
|
||||||
|
abort();
|
||||||
|
strcpy(pref_buf, cwd);
|
||||||
|
strcat(pref_buf, "/");
|
||||||
|
strcat(pref_buf, prefix);
|
||||||
|
free(cwd);
|
||||||
|
} else
|
||||||
|
strcpy(pref_buf,prefix + 1);
|
||||||
|
|
||||||
|
base = new_entry("", NULL, pref_buf);
|
||||||
|
base = add_dir_maybe(base);
|
||||||
|
if (base->num_entries == 0) {
|
||||||
|
free (base);
|
||||||
|
base = NULL;
|
||||||
|
} else {
|
||||||
|
set_parents(base, base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Look for path in emulation dir, otherwise return name. */
|
/* Look for path in emulation dir, otherwise return name. */
|
||||||
const char *path(const char *name)
|
const char *path(const char *name)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue