Browse Source

fix busybox

Chia-Che Tsai 8 years ago
parent
commit
7c5cf0bbe1

+ 5 - 3
LibOS/shim/src/fs/shim_namei.c

@@ -156,7 +156,7 @@ static int do_lookup (struct lookup * look, const char * name, int namelen,
     int err = 0;
     struct shim_dentry * dent = NULL;
 
-    if ((err = lookup_dentry(look->dentry, name, namelen,force, &dent)) < 0)
+    if ((err = lookup_dentry(look->dentry, name, namelen, force, &dent)) < 0)
         goto fail;
 
     path_reacquire(look, dent);
@@ -1054,8 +1054,10 @@ done_read:
     hdl->flags = flags;
     get_dentry(dent);
     hdl->info.dir.dot = dent;
-    put_dentry(dent->parent);
-    hdl->info.dir.dotdot = dent->parent;
+    if (dent->parent) {
+        get_dentry(dent->parent);
+        hdl->info.dir.dotdot = dent->parent;
+    }
     hdl->info.dir.buf = children;
     hdl->info.dir.ptr = children;
 out:

+ 1 - 1
LibOS/shim/src/sys/shim_getcwd.c

@@ -70,7 +70,7 @@ int shim_do_chdir (const char * filename)
     struct shim_dentry * dent = NULL;
     int ret;
 
-    if ((ret = path_lookupat(NULL, filename, 0, &dent)) < 0)
+    if ((ret = path_lookupat(NULL, filename, LOOKUP_SYNC, &dent)) < 0)
         return ret;
 
     if (!dent)

+ 7 - 4
LibOS/shim/test/apps/busybox/busybox.manifest.template

@@ -2,9 +2,12 @@
 
 loader.preload = file:$(SHIMPATH)
 loader.exec = file:busybox
+loader.execname = busybox
 loader.env.PATH = /:/usr/sbin:/usr/bin:/sbin:/bin
-loader.env.LD_LIBRARY_PATH = /lib:/lib64
-loader.exclude_env = USERNAME,HOME,PWD
+loader.env.LD_LIBRARY_PATH = /lib:/lib/x86_64-linux-gnu
+loader.env.USERNAME =
+loader.env.HOME =
+loader.env.PWD =
 loader.debug_type = none
 
 fs.mount.root.type = chroot
@@ -15,5 +18,5 @@ fs.mount.other.lib1.path = /lib
 fs.mount.other.lib1.uri = file:$(GLIBCDIR)
 
 fs.mount.other.lib2.type = chroot
-fs.mount.other.lib2.path = /lib64
-fs.mount.other.lib2.uri = file:/lib
+fs.mount.other.lib2.path = /lib/x86_64-linux-gnu
+fs.mount.other.lib2.uri = file:/lib/x86_64-linux-gnu