diff --git a/utils.c b/utils.c index 48ac146..611a46c 100644 --- a/utils.c +++ b/utils.c @@ -23,6 +23,15 @@ #include #include +#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 + int file_exists_at (int dirfd, const char *pathname) { @@ -120,7 +129,7 @@ cleanup_closep (void *p) { int *pp = p; if (*pp >= 0) - close (*pp); + TEMP_FAILURE_RETRY (close (*pp)); } void