--- lib/system.h	2015-08-21 14:22:37.000000000 +0200
+++ lib/system.h	2015-11-20 04:36:49.563164363 +0100
@@ -35,6 +35,7 @@
 #include <endian.h>
 #include <byteswap.h>
 #include <unistd.h>
+#include <fcntl.h>
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 # define LE32(n)	(n)
@@ -50,6 +50,20 @@
 # error "Unknown byte order"
 #endif
 
+#if !defined(__GLIBC__)
+
+/* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno'
+   set to EINTR.  */
+
+# define TEMP_FAILURE_RETRY(expression) \
+  (__extension__                                                              \
+    ({ long int __result;                                                     \
+       do __result = (long int) (expression);                                 \
+       while (__result == -1L && errno == EINTR);                             \
+       __result; }))
+
+#endif
+
 extern void *xmalloc (size_t) __attribute__ ((__malloc__));
 extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
 extern void *xrealloc (void *, size_t) __attribute__ ((__malloc__));
