Merge "Fix TEMP_FAILURE_RETRY on non-GNU C++ dialects"

This commit is contained in:
Treehugger Robot 2022-03-17 04:05:17 +00:00 committed by Gerrit Code Review
commit addba34668

View file

@ -71,19 +71,17 @@ static inline int ftruncate64(int fd, off64_t length) {
#define CONSTEXPR #define CONSTEXPR
#endif #endif
/* /* TEMP_FAILURE_RETRY is not available on macOS, but still useful there. */
* TEMP_FAILURE_RETRY is defined by some, but not all, versions of
* <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
* not already defined, then define it here.
*/
#ifndef TEMP_FAILURE_RETRY #ifndef TEMP_FAILURE_RETRY
/* Used to retry syscalls that can return EINTR. */ /* Used to retry syscalls that can return EINTR. */
#define TEMP_FAILURE_RETRY(exp) ({ \ #define TEMP_FAILURE_RETRY(exp) \
typeof (exp) _rc; \ ({ \
do { \ __typeof__(exp) _rc; \
_rc = (exp); \ do { \
} while (_rc == -1 && errno == EINTR); \ _rc = (exp); \
_rc; }) } while (_rc == -1 && errno == EINTR); \
_rc; \
})
#endif #endif
#if defined(_WIN32) #if defined(_WIN32)