Revert "More pthreads cleanup."

This reverts commit 2a1bb4e64677b9abbc17173c79768ed494565047

Change-Id: Ia443d0748015c8e9fc3121e40e68258616767b51
diff --git a/libc/bionic/dirent.cpp b/libc/bionic/dirent.cpp
index 74297d8..3a7b5b4 100644
--- a/libc/bionic/dirent.cpp
+++ b/libc/bionic/dirent.cpp
@@ -36,8 +36,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#include "private/ErrnoRestorer.h"
-#include "private/ScopedPthreadMutexLocker.h"
+#include <private/ScopedPthreadMutexLocker.h>
 
 struct DIR {
   int fd_;
@@ -109,7 +108,7 @@
 }
 
 int readdir_r(DIR* d, dirent* entry, dirent** result) {
-  ErrnoRestorer errno_restorer;
+  int saved_errno = errno;
 
   *result = NULL;
   errno = 0;
@@ -125,6 +124,7 @@
     memcpy(entry, next, next->d_reclen);
     *result = entry;
   }
+  errno = saved_errno;
   return 0;
 }