Silences compiler warning:

xshmfence_alloc.c: In function 'xshmfence_alloc_shm':
xshmfence_alloc.c:54:11: warning: ignoring return value of 'ftruncate', 
declared with attribute warn_unused_result [-Wunused-result]
  ftruncate(fd, sizeof (struct xshmfence));
           ^

Signed-off-by: Julien Cristau <[email protected]>
---
 src/xshmfence_alloc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/xshmfence_alloc.c b/src/xshmfence_alloc.c
index d8d4a40..58416cd 100644
--- a/src/xshmfence_alloc.c
+++ b/src/xshmfence_alloc.c
@@ -51,7 +51,10 @@ xshmfence_alloc_shm(void)
                return fd;
             unlink(template);
         }
-       ftruncate(fd, sizeof (struct xshmfence));
+       if (ftruncate(fd, sizeof (struct xshmfence)) < 0) {
+            close(fd);
+            return -1;
+        }
         xshmfence_init(fd);
        return fd;
 }
-- 
1.8.4.3

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to