do not rely on libc providing TEMP_FAILURE_RETRY
authorFelix Fietkau <nbd@openwrt.org>
Fri, 10 Apr 2015 19:59:06 +0000 (21:59 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 10 Apr 2015 19:59:06 +0000 (21:59 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
rexec.c

diff --git a/rexec.c b/rexec.c
index 4148fdd07eeb2ca0efeb16580f270a2635cd4b0f..c60c1bac0a56bc844d6f06ba40dbd49d6f201b49 100644 (file)
--- a/rexec.c
+++ b/rexec.c
 #include <string.h>
 #include <unistd.h>
 
+# define __TEMP_FAILURE_RETRY(expression) \
+  (__extension__                                                             \
+    ({ long int __result;                                                    \
+       do __result = (long int) (expression);                                \
+       while (__result == -1L && errno == EINTR);                            \
+       __result; }))
+
 #define SA_LEN(_x)      __libc_sa_len((_x)->sa_family)
 extern int __libc_sa_len(sa_family_t __af) __THROW attribute_hidden;
 
@@ -138,7 +145,7 @@ retry:
                (void) write(s, num, strlen(num)+1);
                {
                        socklen_t len = sizeof(from);
-                       s3 = TEMP_FAILURE_RETRY(accept(s2,
+                       s3 = __TEMP_FAILURE_RETRY(accept(s2,
                                        (struct sockaddr *)&from, &len));
                        close(s2);
                        if (s3 < 0) {