summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2013-12-03 20:14:38 +0100
committerKeith Packard <keithp@keithp.com>2013-12-03 15:13:14 -0800
commitca4ef282b55f3f05acc29a7c76b624f130cc74de (patch)
treef8d2f1ebc62bd8409f8b9b92c83358437e10cee0
parente8dd66fee206f93e1bee059bdadde064901ed745 (diff)
downloadxorg-lib-libxshmfence-ca4ef282b55f3f05acc29a7c76b624f130cc74de.tar.gz
Check return value from ftruncate
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 <jcristau@debian.org> Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/xshmfence_alloc.c5
1 files changed, 4 insertions, 1 deletions
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;
}