summaryrefslogtreecommitdiff
path: root/glib/gthreadprivate.h
diff options
context:
space:
mode:
Diffstat (limited to 'glib/gthreadprivate.h')
-rw-r--r--glib/gthreadprivate.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/glib/gthreadprivate.h b/glib/gthreadprivate.h
index 9c847e039..74d37ba32 100644
--- a/glib/gthreadprivate.h
+++ b/glib/gthreadprivate.h
@@ -65,9 +65,13 @@ struct _GRealThread
#define g_futex_simple(uaddr, futex_op, ...) \
G_STMT_START \
{ \
+ int saved_errno = errno; \
int res = syscall (__NR_futex_time64, uaddr, (gsize) futex_op, __VA_ARGS__); \
if (res < 0 && errno == ENOSYS) \
- syscall (__NR_futex, uaddr, (gsize) futex_op, __VA_ARGS__); \
+ { \
+ errno = saved_errno; \
+ syscall (__NR_futex, uaddr, (gsize) futex_op, __VA_ARGS__); \
+ } \
} \
G_STMT_END
#elif defined(__NR_futex_time64)