Chromium Code Reviews| 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 9ddfed9b3b272b41041ce1f11ceebc716669485d..434d8350641118ae14062346ad18a1bd9705ab61 100644 |
| --- a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc |
| +++ b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc |
| @@ -86,7 +86,8 @@ KernelProxy::~KernelProxy() { |
| delete ppapi_; |
| } |
| -void KernelProxy::Init(PepperInterface* ppapi) { |
| +Error KernelProxy::Init(PepperInterface* ppapi) { |
| + Error rtn = 0; |
| ppapi_ = ppapi; |
| dev_ = 1; |
| @@ -98,15 +99,33 @@ void KernelProxy::Init(PepperInterface* ppapi) { |
| int result; |
| result = mount("", "/", "passthroughfs", 0, NULL); |
| - assert(result == 0); |
| + if (result != 0) { |
| + assert(false); |
| + rtn = errno; |
| + } |
| result = mount("", "/dev", "dev", 0, NULL); |
| - assert(result == 0); |
| + if (result != 0) { |
| + assert(false); |
| + rtn = errno; |
| + } |
| // Open the first three in order to get STDIN, STDOUT, STDERR |
| - open("/dev/stdin", O_RDONLY); |
| - open("/dev/stdout", O_WRONLY); |
| - open("/dev/stderr", O_WRONLY); |
| + int fd; |
| + fd = open("/dev/stdin", O_RDONLY); |
| + assert(fd == 0); |
| + if (fd < 0) |
| + rtn = fd; |
|
binji
2013/09/04 20:21:48
rtn = errno?
Sam Clegg
2013/09/04 20:54:43
Done.
|
| + |
| + fd = open("/dev/stdout", O_WRONLY); |
| + assert(fd == 1); |
| + if (fd < 0) |
| + rtn = fd; |
| + |
| + fd = open("/dev/stderr", O_WRONLY); |
| + assert(fd == 2); |
| + if (fd < 0) |
| + rtn = fd; |
| #ifdef PROVIDES_SOCKET_API |
| host_resolver_.Init(ppapi_); |
| @@ -114,7 +133,13 @@ void KernelProxy::Init(PepperInterface* ppapi) { |
| StringMap_t args; |
| socket_mount_.reset(new MountSocket()); |
| - socket_mount_->Init(0, args, ppapi); |
| + result = socket_mount_->Init(0, args, ppapi); |
| + if (result != 0) { |
| + assert(false); |
| + rtn = result; |
| + } |
| + |
| + return rtn; |
| } |
| int KernelProxy::open_resource(const char* path) { |