From: brian Date: Fri, 21 May 2004 02:18:50 +0000 (-0700) Subject: chdir bug X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=commitdiff_plain;h=7ee30b5692515ac602c88745aaa8c71eb82d376c chdir bug darcs-hash:20040521021850-24bed-d3ab1c5e4a342c641b02d40ce43482ecb9b4159b.gz --- diff --git a/src/org/ibex/nestedvm/UnixRuntime.java b/src/org/ibex/nestedvm/UnixRuntime.java index 4c9ed5a..4475795 100644 --- a/src/org/ibex/nestedvm/UnixRuntime.java +++ b/src/org/ibex/nestedvm/UnixRuntime.java @@ -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; }