Revert "More pthreads cleanup."

This reverts commit 2a1bb4e64677b9abbc17173c79768ed494565047

Change-Id: Ia443d0748015c8e9fc3121e40e68258616767b51
diff --git a/libc/bionic/pthread_sigmask.cpp b/libc/bionic/pthread_sigmask.cpp
index e4e1b2b..9c9dc3e 100644
--- a/libc/bionic/pthread_sigmask.cpp
+++ b/libc/bionic/pthread_sigmask.cpp
@@ -30,13 +30,12 @@
 #include <pthread.h>
 #include <signal.h>
 
-#include "private/ErrnoRestorer.h"
-#include "private/kernel_sigset_t.h"
+#include <private/kernel_sigset_t.h>
 
 extern "C" int __rt_sigprocmask(int, const kernel_sigset_t*, kernel_sigset_t*, size_t);
 
 int pthread_sigmask(int how, const sigset_t* iset, sigset_t* oset) {
-  ErrnoRestorer errno_restorer;
+  int old_errno = errno;
 
   // 'in_set_ptr' is the second parameter to __rt_sigprocmask. It must be NULL
   // if 'set' is NULL to ensure correct semantics (which in this case would
@@ -49,13 +48,15 @@
   }
 
   kernel_sigset_t out_set;
-  if (__rt_sigprocmask(how, in_set_ptr, &out_set, sizeof(out_set)) == -1) {
-    return errno;
+  int result = __rt_sigprocmask(how, in_set_ptr, &out_set, sizeof(out_set));
+  if (result < 0) {
+    result = errno;
   }
 
   if (oset != NULL) {
     *oset = out_set.bionic;
   }
 
-  return 0;
+  errno = old_errno;
+  return result;
 }