Index: native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc |
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc |
index ebe8dd528bb1d3d61ace938baaed2fe2b291611e..fecd72f9916c816c4a6183cc261cedaefdcace26 100644 |
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc |
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc |
@@ -269,13 +269,11 @@ 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; |
+ if (!REAL(func)) { \ |
+ assign_real_pointers(); \ |
+ if (!REAL(func)) \ |
+ return ENOSYS; \ |
+ } |
// "real" functions, i.e. the unwrapped original functions. |
@@ -285,7 +283,8 @@ int _real_close(int fd) { |
} |
void _real_exit(int status) { |
- CHECK_REAL(exit); |
+ if (!REAL(exit)) |
+ assign_real_pointers(); |
REAL(exit)(status); |
} |
@@ -360,7 +359,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); |
} |