--- a/config.h.in +++ b/config.h.in @@ -148,3 +148,15 @@ /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE + +/* taken from glibc unistd.h and fixes musl */ +#ifndef TEMP_FAILURE_RETRY +#define TEMP_FAILURE_RETRY(expression) \ + (__extension__ \ + ({ long int __result; \ + do __result = (long int) (expression); \ + while (__result == -1L && errno == EINTR); \ + __result; })) +#endif + + diff --git a/libglnx/glnx-dirfd.h b/libglnx/glnx-dirfd.h index 0046ac8..79b9f6a 100644 --- a/libglnx/glnx-dirfd.h +++ b/libglnx/glnx-dirfd.h @@ -28,6 +28,16 @@ #include #include +/* taken from glibc unistd.h and fixes musl */ +#ifndef TEMP_FAILURE_RETRY +#define TEMP_FAILURE_RETRY(expression) \ + (__extension__ \ + ({ long int __result; \ + do __result = (long int) (expression); \ + while (__result == -1L && errno == EINTR); \ + __result; })) +#endif + G_BEGIN_DECLS /** diff --git a/libglnx/glnx-fdio.h b/libglnx/glnx-fdio.h index c0a7cc1..8f72920 100644 --- a/libglnx/glnx-fdio.h +++ b/libglnx/glnx-fdio.h @@ -35,6 +35,17 @@ #include #include +/* taken from glibc unistd.h and fixes musl */ +#ifndef TEMP_FAILURE_RETRY +#define TEMP_FAILURE_RETRY(expression) \ + (__extension__ \ + ({ long int __result; \ + do __result = (long int) (expression); \ + while (__result == -1L && errno == EINTR); \ + __result; })) +#endif + + G_BEGIN_DECLS /* Irritatingly, g_basename() which is what we want diff --git a/libglnx/glnx-xattrs.c b/libglnx/glnx-xattrs.c index 79a14cd..ebb96d4 100644 --- a/libglnx/glnx-xattrs.c +++ b/libglnx/glnx-xattrs.c @@ -28,6 +28,16 @@ #include #include +/* taken from glibc unistd.h and fixes musl */ +#ifndef TEMP_FAILURE_RETRY +#define TEMP_FAILURE_RETRY(expression) \ + (__extension__ \ + ({ long int __result; \ + do __result = (long int) (expression); \ + while (__result == -1L && errno == EINTR); \ + __result; })) +#endif + static GVariant * variant_new_ay_bytes (GBytes *bytes) {