summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2019-09-17 09:24:39 +0000
committerColin Walters <walters@verbum.org>2019-09-17 09:24:39 +0000
commit15c06468804014fc49f6f340132930703f919b19 (patch)
tree52448fd48cd8072a79b9999d4f2522c9b144c64e
parent8f34033b256da5a8e2cc66faf8e81cfdfb9cdf37 (diff)
parent460400c19cfbf7bed2443b263d56094b7018e23a (diff)
downloadlibglnx-15c06468804014fc49f6f340132930703f919b19.tar.gz
Merge branch 'us-temp-failure-retry' into 'master'
macros: Add TEMP_FAILURE_RETRY for musl See merge request GNOME/libglnx!9
-rw-r--r--glnx-macros.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/glnx-macros.h b/glnx-macros.h
index 6d8aca9..700fc75 100644
--- a/glnx-macros.h
+++ b/glnx-macros.h
@@ -31,6 +31,16 @@ G_BEGIN_DECLS
/* All of these are for C only. */
#ifndef __GI_SCANNER__
+/* fixes builds against musl, taken from glibc unistd.h */
+#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
+
/* Taken from https://github.com/systemd/systemd/src/basic/string-util.h
* at revision v228-666-gcf6c8c4
*/