From 654a25d4080ce511b1f4240748e65fad7fc91cbc Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 3 Oct 2024 17:16:59 +0100 Subject: [PATCH] utils: Move TEMP_FAILURE_RETRY reimplementation here This will allow it to be used in more places. Helps: https://github.com/containers/bubblewrap/issues/657 Signed-off-by: Simon McVittie --- bubblewrap.c | 9 --------- utils.h | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bubblewrap.c b/bubblewrap.c index 9f87e907..f75dec7f 100644 --- a/bubblewrap.c +++ b/bubblewrap.c @@ -44,15 +44,6 @@ #define CLONE_NEWCGROUP 0x02000000 /* New cgroup namespace */ #endif -#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 - /* We limit the size of a tmpfs to half the architecture's address space, * to avoid hitting arbitrary limits in the kernel. * For example, on at least one x86_64 machine, the actual limit seems to be diff --git a/utils.h b/utils.h index ced43513..d76b1b18 100644 --- a/utils.h +++ b/utils.h @@ -46,6 +46,15 @@ #define FALSE 0 typedef int bool; +#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 + #define PIPE_READ_END 0 #define PIPE_WRITE_END 1