summaryrefslogtreecommitdiffstats
path: root/libc/bionic/tmpfile.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-02-12 16:40:24 +0000
committerElliott Hughes <enh@google.com>2013-02-12 15:27:18 -0800
commit3e898476c7230b60a0f76968e64ff25f475b48c0 (patch)
tree0f876aeb565b7e7ac627a6305a355c40173912f2 /libc/bionic/tmpfile.cpp
parentfcaf4e9f9b735e053469c7ecbf63584e10fd67a7 (diff)
downloadbionic-3e898476c7230b60a0f76968e64ff25f475b48c0.zip
bionic-3e898476c7230b60a0f76968e64ff25f475b48c0.tar.gz
bionic-3e898476c7230b60a0f76968e64ff25f475b48c0.tar.bz2
Revert "Revert "More pthreads cleanup.""
This reverts commit 6f94de3ca49e4ea147b1c59e5818fa175846518f (Doesn't try to increase the number of TLS slots; that leads to an inability to boot. Adds more tests.) Change-Id: Ia7d25ba3995219ed6e686463dbba80c95cc831ca
Diffstat (limited to 'libc/bionic/tmpfile.cpp')
-rw-r--r--libc/bionic/tmpfile.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libc/bionic/tmpfile.cpp b/libc/bionic/tmpfile.cpp
index b97cc6c..8419ff5 100644
--- a/libc/bionic/tmpfile.cpp
+++ b/libc/bionic/tmpfile.cpp
@@ -38,6 +38,8 @@
#include <sys/types.h>
#include <unistd.h>
+#include "private/ErrnoRestorer.h"
+
class ScopedSignalBlocker {
public:
ScopedSignalBlocker() {
@@ -77,9 +79,8 @@ static FILE* __tmpfile_dir(const char* tmp_dir) {
struct stat sb;
int rc = fstat(fd, &sb);
if (rc == -1) {
- int old_errno = errno;
+ ErrnoRestorer errno_restorer;
close(fd);
- errno = old_errno;
return NULL;
}
}
@@ -91,9 +92,8 @@ static FILE* __tmpfile_dir(const char* tmp_dir) {
}
// Failure. Clean up. We already unlinked, so we just need to close.
- int old_errno = errno;
+ ErrnoRestorer errno_restorer;
close(fd);
- errno = old_errno;
return NULL;
}