xserver: Branch 'master'
Adam Jackson
ajax at kemper.freedesktop.org
Mon Apr 25 19:35:59 UTC 2016
hw/xwayland/xwayland-shm.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
New commits:
commit f48b0534f110397246809d279225afedb28aa233
Author: Marek Chalupa <mchqwerty at gmail.com>
Date: Mon Apr 25 11:33:00 2016 +0200
xwayland-shm: fortify fallocate against EINTR
If posix_fallocate or ftruncate is interrupted by signal while working,
we return -1 as fd and the allocation process returns BadAlloc error.
That causes xwayland clients to abort with 'BadAlloc (insufficient
resources for operation)' even when there's a lot of resources
available.
Fix it by trying again when we get EINTR.
Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
index e8545b3..c199e5e 100644
--- a/hw/xwayland/xwayland-shm.c
+++ b/hw/xwayland/xwayland-shm.c
@@ -140,14 +140,20 @@ os_create_anonymous_file(off_t size)
return -1;
#ifdef HAVE_POSIX_FALLOCATE
- ret = posix_fallocate(fd, 0, size);
+ do {
+ ret = posix_fallocate(fd, 0, size);
+ } while (ret == EINTR);
+
if (ret != 0) {
close(fd);
errno = ret;
return -1;
}
#else
- ret = ftruncate(fd, size);
+ do {
+ ret = ftruncate(fd, size);
+ } while (ret == -1 && errno == EINTR);
+
if (ret < 0) {
close(fd);
return -1;
More information about the xorg-commit
mailing list