chdir bug
authorbrian <brian@brianweb.net>
Fri, 21 May 2004 02:18:50 +0000 (19:18 -0700)
committerbrian <brian@brianweb.net>
Fri, 21 May 2004 02:18:50 +0000 (19:18 -0700)
darcs-hash:20040521021850-24bed-d3ab1c5e4a342c641b02d40ce43482ecb9b4159b.gz

src/org/ibex/nestedvm/UnixRuntime.java

index 4c9ed5a..4475795 100644 (file)
@@ -514,10 +514,10 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
     
     private int sys_chdir(int addr) throws ErrnoException, FaultException {
         String path = normalizePath(cstring(addr));
-        //System.err.println("Chdir: " + cstring(addr) + " -> " + path + " pwd: " + cwd);
-        if(gs.stat(this,path).type() != FStat.S_IFDIR) return -ENOTDIR;
+        FStat st = gs.stat(this,path);
+        if(st == null) return -ENOENT;
+        if(st.type() != FStat.S_IFDIR) return -ENOTDIR;
         cwd = path;
-        //System.err.println("Now: [" + cwd + "]");
         return 0;
     }