linux-user: don't crash with null name

From Thayne Harbaugh.

path() may be called with null string, don't bother trying to
remap in that case.

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6480 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
aurel32 2009-01-30 19:48:07 +00:00
parent 8f7aeaf6b3
commit a516e72d60

View File

@ -152,7 +152,7 @@ const char *path(const char *name)
{ {
/* Only do absolute paths: quick and dirty, but should mostly be OK. /* Only do absolute paths: quick and dirty, but should mostly be OK.
Could do relative by tracking cwd. */ Could do relative by tracking cwd. */
if (!base || name[0] != '/') if (!base || !name || name[0] != '/')
return name; return name;
return follow_path(base, name) ?: name; return follow_path(base, name) ?: name;