From 5ef6bd7eeec67b9726b78037a868d9f0975d3522 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 23 Mar 2017 11:59:23 -0500 Subject: [PATCH] os: Check for EINTR on ftruncate() The man page indicates that ftruncate() can set errno to EINTR, so test for this. I have not actually been able to provoke an EINTR error from ftruncate() in testing though. Signed-off-by: Derek Foreman Reviewed-by: Eric Engestrom Reviewed-by: Quentin Glidic --- shared/os-compatibility.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/os-compatibility.c b/shared/os-compatibility.c index 6b2f3770..e19fb61b 100644 --- a/shared/os-compatibility.c +++ b/shared/os-compatibility.c @@ -187,7 +187,9 @@ os_create_anonymous_file(off_t size) return -1; } #else - ret = ftruncate(fd, size); + do { + ret = ftruncate(fd, size); + } while (ret < 0 && errno == EINTR); if (ret < 0) { close(fd); return -1;