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 <der...@osg.samsung.com>
---
 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;
-- 
2.11.0

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to