From b8372da83bb6fe6064c1f6387411a5b2af9f4e7b Mon Sep 17 00:00:00 2001 From: Brent Baccala Date: Wed, 13 Jun 2012 13:53:32 -0800 Subject: [PATCH 1/1] Fix two bugs in UnixRuntime and change Pipe class to be public - sys_access needs to normalize paths just like everyone else - DevFS wasn't parsing file descriptors right in open() - Pipe is useful for moving data between Java and C --- src/org/ibex/nestedvm/UnixRuntime.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/ibex/nestedvm/UnixRuntime.java b/src/org/ibex/nestedvm/UnixRuntime.java index 306b70e..adddc51 100644 --- a/src/org/ibex/nestedvm/UnixRuntime.java +++ b/src/org/ibex/nestedvm/UnixRuntime.java @@ -195,7 +195,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { private int sys_access(int cstring, int mode) throws ErrnoException, ReadFaultException { // FEATURE: sys_access - return gs.stat(this,cstring(cstring)) == null ? -ENOENT : 0; + return gs.stat(this,normalizePath(cstring(cstring))) == null ? -ENOENT : 0; } private int sys_realpath(int inAddr, int outAddr) throws FaultException { @@ -563,7 +563,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { return 0; } - static class Pipe { + public static class Pipe { private final byte[] pipebuf = new byte[PIPE_BUF*4]; private int readPos; private int writePos; @@ -1811,7 +1811,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { if(path.startsWith("fd/")) { int n; try { - n = Integer.parseInt(path.substring(4)); + n = Integer.parseInt(path.substring(3)); } catch(NumberFormatException e) { return null; } -- 1.7.10.4