mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-22 00:48:53 +02:00
Merge branch 'backport-3398-futex-errno-glib-2-76' into 'glib-2-76'
Backport !3398 “Avoid having g_futex_simple() inadvertently modify errno” to glib-2-76 See merge request GNOME/glib!3402
This commit is contained in:
@@ -65,9 +65,13 @@ struct _GRealThread
|
|||||||
#define g_futex_simple(uaddr, futex_op, ...) \
|
#define g_futex_simple(uaddr, futex_op, ...) \
|
||||||
G_STMT_START \
|
G_STMT_START \
|
||||||
{ \
|
{ \
|
||||||
|
int saved_errno = errno; \
|
||||||
int res = syscall (__NR_futex_time64, uaddr, (gsize) futex_op, __VA_ARGS__); \
|
int res = syscall (__NR_futex_time64, uaddr, (gsize) futex_op, __VA_ARGS__); \
|
||||||
if (res < 0 && errno == ENOSYS) \
|
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
|
G_STMT_END
|
||||||
#elif defined(__NR_futex_time64)
|
#elif defined(__NR_futex_time64)
|
||||||
|
Reference in New Issue
Block a user