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

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

Issue 576363002: [NaCl SDK] nacl_io: handle null irt function pointers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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_wrap_glibc.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc
index a264eebd71796437b8cf1800086d0d5e8e1ba609..308a0929ba48e93a4a40e436112b47eedf4a2922 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc
@@ -524,14 +524,12 @@ static void assign_real_pointers() {
}
}
-#define CHECK_REAL(func) \
- if (!REAL(func)) \
- assign_real_pointers();
-
-#define CHECK_REAL_NOSYS(func) \
- CHECK_REAL(func) \
- if (!REAL(func)) \
- return ENOSYS;
+#define CHECK_REAL(func) \
+ if (!REAL(func)) { \
+ assign_real_pointers(); \
+ if (!REAL(func)) \
+ return ENOSYS; \
+ }
// "real" functions, i.e. the unwrapped original functions.
@@ -541,7 +539,8 @@ int _real_close(int fd) {
}
void _real_exit(int status) {
- CHECK_REAL(exit);
+ if (!REAL(exit))
+ assign_real_pointers();
REAL(exit)(status);
}
@@ -639,7 +638,7 @@ int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) {
}
int _real_getcwd(char* pathname, size_t len) {
- CHECK_REAL_NOSYS(getcwd);
+ CHECK_REAL(getcwd);
return REAL(getcwd)(pathname, len);
}

Powered by Google App Engine
This is Rietveld 408576698