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>
diff --git a/shared/os-compatibility.c b/shared/os-compatibility.c
index 6b2f377..e19fb61 100644
--- a/shared/os-compatibility.c
+++ b/shared/os-compatibility.c
@@ -187,7 +187,9 @@
return -1;
}
#else
- ret = ftruncate(fd, size);
+ do {
+ ret = ftruncate(fd, size);
+ } while (ret < 0 && errno == EINTR);
if (ret < 0) {
close(fd);
return -1;