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

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

Issue 414993002: [NaCl SDK] nacl_io: Remove duplication between passthroughfs and devfs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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_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 af3ecca9587afe138f161c6b7d83bf9b50769f97..1236e5da161f5de0fb75966afded3b66ea1cce70 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
@@ -46,6 +46,7 @@ EXTERN_C_BEGIN
__libnacl_irt_##group.name = (typeof(REAL(name)))WRAP(name);
extern void __libnacl_irt_dev_filename_init(void);
+extern void __libnacl_irt_dev_fdio_init(void);
extern struct nacl_irt_basic __libnacl_irt_basic;
extern struct nacl_irt_fdio __libnacl_irt_fdio;
@@ -261,13 +262,14 @@ static void assign_real_pointers() {
static bool assigned = false;
if (!assigned) {
__libnacl_irt_dev_filename_init();
+ __libnacl_irt_dev_fdio_init();
EXPAND_SYMBOL_LIST_OPERATION(ASSIGN_REAL_PTR)
assigned = true;
}
}
-#define CHECK_REAL(func) \
- if (!REAL(func)) \
+#define CHECK_REAL(func) \
+ if (!REAL(func)) \
assign_real_pointers();
// "real" functions, i.e. the unwrapped original functions.
@@ -289,6 +291,12 @@ int _real_fstat(int fd, struct stat* buf) {
int _real_isatty(int fd, int* result) {
CHECK_REAL(isatty);
+ // The real isatty function can be NULL (for example if we are running
+ // withing chrome).
+ if (REAL(isatty) == NULL) {
+ *result = 0;
+ return ENOTTY;
+ }
return REAL(isatty)(fd, result);
}
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc ('k') | native_client_sdk/src/libraries/nacl_io/library.dsc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698