summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/openat.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/openat.c')
-rw-r--r--libc/sysdeps/linux/common/openat.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/common/openat.c b/libc/sysdeps/linux/common/openat.c
index f71567cdc..62451df4c 100644
--- a/libc/sysdeps/linux/common/openat.c
+++ b/libc/sysdeps/linux/common/openat.c
@@ -9,6 +9,7 @@
#include <sys/syscall.h>
#include <fcntl.h>
#include <stdarg.h>
+#include <cancel.h>
#ifdef __NR_openat
# define __NR___syscall_openat __NR_openat
@@ -16,13 +17,25 @@ static __inline__ _syscall4(int, __syscall_openat, int, fd, const char *, file,
int __openat(int fd, const char *file, int o_flag, ...)
{
+#ifdef __NEW_THREADS
+ int oldtype, result;
+#endif
va_list ap;
mode_t mode;
va_start(ap, o_flag);
mode = va_arg(ap, int);
va_end(ap);
- return __syscall_openat(fd, file, o_flag, mode);
+
+ if (SINGLE_THREAD_P)
+ return __syscall_openat(fd, file, o_flag, mode);
+
+#ifdef __NEW_THREADS
+ oldtype = LIBC_CANCEL_ASYNC ();
+ result = __syscall_openat(fd, file, o_flag, mode);
+ LIBC_CANCEL_RESET (oldtype);
+ return result;
+#endif
}
strong_alias_untyped(__openat,openat)