Index: lib/Support/Unix/Process.inc |
diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc |
index a429bb3984c888a81bafe78031102c08686910ad..eaed72666f9c489ec72270219ba6e9802ad6ec52 100644 |
--- a/lib/Support/Unix/Process.inc |
+++ b/lib/Support/Unix/Process.inc |
@@ -265,6 +265,16 @@ std::error_code Process::FixupStandardFileDescriptors() { |
} |
std::error_code Process::SafelyCloseFileDescriptor(int FD) { |
+ // @LOCALMOD-BEGIN: For NaCl, don't use pthread_sigmask, etc. |
+ // They are stubs and fail with ENOSYS, which make this return |
+ // an error. |
+#ifdef __native_client__ |
+ int ErrnoFromClose = 0; |
+ if (::close(FD) < 0) |
+ ErrnoFromClose = errno; |
+ return std::error_code(ErrnoFromClose, std::generic_category()); |
+#else |
+ |
// Create a signal set filled with *all* signals. |
sigset_t FullSet; |
if (sigfillset(&FullSet) < 0) |
@@ -297,6 +307,7 @@ std::error_code Process::SafelyCloseFileDescriptor(int FD) { |
if (ErrnoFromClose) |
return std::error_code(ErrnoFromClose, std::generic_category()); |
return std::error_code(EC, std::generic_category()); |
+#endif // @LOCALMOD-END |
} |
bool Process::StandardInIsUserInput() { |