Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1797)

Unified Diff: native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc

Issue 22842011: [NaCl SDK] Remove invalid assert from nacl_io. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 84e531e8fa439ce602ff7e43870e1f9ee12f4e55..87e299833e986d53d8466f3979a814b4772638c3 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
@@ -85,7 +85,8 @@ KernelProxy::~KernelProxy() {
delete ppapi_;
}
-void KernelProxy::Init(PepperInterface* ppapi) {
+Error KernelProxy::Init(PepperInterface* ppapi) {
+ Error rtn = 0;
ppapi_ = ppapi;
dev_ = 1;
@@ -98,14 +99,22 @@ void KernelProxy::Init(PepperInterface* ppapi) {
int result;
result = mount("", "/", "passthroughfs", 0, NULL);
assert(result == 0);
+ if (result != 0)
binji 2013/08/24 01:35:57 maybe use assert(false) inside the if instead?
+ rtn = errno;
result = mount("", "/dev", "dev", 0, NULL);
assert(result == 0);
+ if (result != 0)
+ 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);
+ fd = open("/dev/stdout", O_WRONLY);
+ assert(fd == 1);
+ fd = open("/dev/stderr", O_WRONLY);
+ assert(fd == 2);
#ifdef PROVIDES_SOCKET_API
host_resolver_.Init(ppapi_);
@@ -113,7 +122,12 @@ 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);
+ assert(result == 0);
+ if (result != 0)
+ rtn = result;
+
+ return rtn;
}
int KernelProxy::open_resource(const char* path) {
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/kernel_proxy.h ('k') | native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698