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

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, 3 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 9ddfed9b3b272b41041ce1f11ceebc716669485d..a929a6a169a53ec30a4fb115c0f274d610ba101b 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 = errno;
+
+ fd = open("/dev/stdout", O_WRONLY);
+ assert(fd == 1);
+ if (fd < 0)
+ rtn = errno;
+
+ fd = open("/dev/stderr", O_WRONLY);
+ assert(fd == 2);
+ if (fd < 0)
+ rtn = errno;
#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) {
« 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