summaryrefslogtreecommitdiff
path: root/shared/os-compatibility.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-03-23 11:59:23 -0500
committerQuentin Glidic <sardemff7+git@sardemff7.net>2017-03-24 21:02:30 +0100
commit5ef6bd7eeec67b9726b78037a868d9f0975d3522 (patch)
tree9117ca696d9c2b040979a8efd74205777ab878ed /shared/os-compatibility.c
parent91d4bce7c33338473f649108e326a6405eeff58b (diff)
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 <derekf@osg.samsung.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Diffstat (limited to 'shared/os-compatibility.c')
-rw-r--r--shared/os-compatibility.c4
1 files changed, 3 insertions, 1 deletions
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;