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>
dev
Derek Foreman 8 years ago committed by Quentin Glidic
parent 91d4bce7c3
commit 5ef6bd7eee
No known key found for this signature in database
GPG Key ID: AC203F96E2C34BB7
  1. 2
      shared/os-compatibility.c

@ -187,7 +187,9 @@ os_create_anonymous_file(off_t size)
return -1; return -1;
} }
#else #else
do {
ret = ftruncate(fd, size); ret = ftruncate(fd, size);
} while (ret < 0 && errno == EINTR);
if (ret < 0) { if (ret < 0) {
close(fd); close(fd);
return -1; return -1;

Loading…
Cancel
Save