summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--linux-user/path.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/linux-user/path.c b/linux-user/path.c
index 9e49076dc8..76809705a4 100644
--- a/linux-user/path.c
+++ b/linux-user/path.c
@@ -101,7 +101,12 @@ 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. */