summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/open.c')
-rw-r--r--libc/sysdeps/linux/common/open.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c
index fd37ea0f0..bfcb341de 100644
--- a/libc/sysdeps/linux/common/open.c
+++ b/libc/sysdeps/linux/common/open.c
@@ -28,6 +28,9 @@ int __open_nocancel(const char *, int, mode_t) __nonnull ((1)) attribute_hidden;
int open(const char *file, int oflag, ...)
{
mode_t mode = 0;
+#ifdef __NEW_THREADS
+ int oldtype, result;
+#endif
if (oflag & O_CREAT) {
va_list arg;
@@ -44,11 +47,11 @@ int open(const char *file, int oflag, ...)
#endif
#ifdef __NEW_THREADS
- int oldtype = LIBC_CANCEL_ASYNC ();
+ oldtype = LIBC_CANCEL_ASYNC ();
# if defined(__NR_open)
- int result = __NC(open)(file, oflag, mode);
+ result = __NC(open)(file, oflag, mode);
# else
- int result = openat(AT_FDCWD, file, oflag, mode);
+ result = openat(AT_FDCWD, file, oflag, mode);
# endif
LIBC_CANCEL_RESET (oldtype);
return result;