Index: native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc |
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc |
index e04e4292d9a3f9e59fb6037e6f05f8256fc9387e..a0239a088373dcb6e667d8e163c825da54247d87 100644 |
--- a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc |
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc |
@@ -84,40 +84,46 @@ Error KernelProxy::Init(PepperInterface* ppapi) { |
ScopedFilesystem root_fs; |
rtn = MountInternal("", "/", "passthroughfs", 0, NULL, false, &root_fs); |
if (rtn != 0) |
- assert(false); |
+ return rtn; |
ScopedFilesystem fs; |
rtn = MountInternal("", "/dev", "dev", 0, NULL, false, &fs); |
if (rtn != 0) |
- assert(false); |
+ return rtn; |
dev_fs_ = sdk_util::static_scoped_ref_cast<DevFs>(fs); |
// Create the filesystem nodes for / and /dev afterward. They can't be |
// created the normal way because the dev filesystem didn't exist yet. |
rtn = CreateFsNode(root_fs); |
if (rtn != 0) |
- assert(false); |
+ return rtn; |
rtn = CreateFsNode(dev_fs_); |
if (rtn != 0) |
- assert(false); |
+ return rtn; |
// Open the first three in order to get STDIN, STDOUT, STDERR |
int fd; |
fd = open("/dev/stdin", O_RDONLY, 0); |
+ if (fd < 0) { |
+ LOG_ERROR("failed to /dev/stdin: %s", strerror(errno)); |
binji
2014/10/08 01:26:13
failed to open
Sam Clegg
2014/10/08 02:01:02
Done.
|
+ return errno; |
+ } |
assert(fd == 0); |
- if (fd < 0) |
- rtn = errno; |
fd = open("/dev/stdout", O_WRONLY, 0); |
+ if (fd < 0) { |
+ LOG_ERROR("failed to /dev/stdout: %s", strerror(errno)); |
+ return errno; |
+ } |
assert(fd == 1); |
- if (fd < 0) |
- rtn = errno; |
fd = open("/dev/stderr", O_WRONLY, 0); |
+ if (fd < 0) { |
+ LOG_ERROR("failed to open /dev/sterr: %s", strerror(errno)); |
+ return errno; |
+ } |
assert(fd == 2); |
- if (fd < 0) |
- rtn = errno; |
#ifdef PROVIDES_SOCKET_API |
host_resolver_.Init(ppapi_); |
@@ -129,11 +135,11 @@ Error KernelProxy::Init(PepperInterface* ppapi) { |
stream_fs_.reset(new StreamFs()); |
int result = stream_fs_->Init(args); |
if (result != 0) { |
- assert(false); |
- rtn = result; |
+ LOG_ERROR("error initializeing streamfs: %s", strerror(result)); |
binji
2014/10/08 01:26:12
sp: initializing
Sam Clegg
2014/10/08 02:01:02
Done.
|
+ return result; |
} |
- return rtn; |
+ return 0; |
} |
bool KernelProxy::RegisterFsType(const char* fs_type, |
@@ -1136,7 +1142,7 @@ int KernelProxy::sigaction(int signum, |
if (action && action->sa_handler != SIG_DFL) { |
// Trying to set this action to anything other than SIG_DFL |
// is not yet supported. |
- LOG_TRACE("sigaction on signal %d != SIG_DFL not supported.", sig); |
+ LOG_TRACE("sigaction on signal %d != SIG_DFL not supported.", signum); |
errno = EINVAL; |
return -1; |
} |
@@ -1203,7 +1209,7 @@ int KernelProxy::select(int nfds, |
if ((timeout->tv_sec < 0) || (timeout->tv_sec >= (INT_MAX / 1000)) || |
(timeout->tv_usec < 0) || (timeout->tv_usec >= 1000000) || (ms < 0) || |
(ms >= INT_MAX)) { |
- LOG_TRACE("Invalid timeout: tv_sec=%d tv_usec=%d.", |
+ LOG_TRACE("Invalid timeout: tv_sec=%lld tv_usec=%ld.", |
binji
2014/10/08 01:26:13
is this correct for all platforms?
Sam Clegg
2014/10/08 02:01:02
Done.
|
timeout->tv_sec, |
timeout->tv_usec); |
errno = EINVAL; |