mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-19 07:08:54 +02:00
Merge branch 'pkj/fix-g_futex_simple' into 'main'
Avoid having g_futex_simple() inadvertently modify errno See merge request GNOME/glib!3398
This commit is contained in:
@@ -65,10 +65,14 @@ 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) \
|
||||||
|
{ \
|
||||||
|
errno = saved_errno; \
|
||||||
syscall (__NR_futex, uaddr, (gsize) futex_op, __VA_ARGS__); \
|
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)
|
||||||
#define g_futex_simple(uaddr, futex_op, ...) \
|
#define g_futex_simple(uaddr, futex_op, ...) \
|
||||||
|
Reference in New Issue
Block a user