From f4cb6a398b26cc078f6aa8d5c30f707d6e258749 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Fri, 13 Mar 2015 20:26:24 -0400 Subject: [PATCH] uuid: Check error on ftruncate call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Fixes warning: src/bin/e_uuid_store.c:71:4: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result] ftruncate(store->shmfd, TABLE_SIZE); ^ Signed-off-by: Bryce Harrington Reviewers: zmike Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2156 --- src/bin/e_uuid_store.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bin/e_uuid_store.c b/src/bin/e_uuid_store.c index e5f65c24b..c21534c05 100644 --- a/src/bin/e_uuid_store.c +++ b/src/bin/e_uuid_store.c @@ -44,6 +44,11 @@ e_uuid_dump(void) } } +/** + * Initialize the UUID store + * + * @returns 1 if init was successful, 0 on failure + */ EINTERN int e_uuid_store_init(void) { @@ -68,7 +73,11 @@ e_uuid_store_init(void) /* Adjust in memory blob to our given table size */ /* FIXME: How can we make sure we have the right size for our given table? */ - ftruncate(store->shmfd, TABLE_SIZE); + if (ftruncate(store->shmfd, TABLE_SIZE) < 0) + { + ERR("ftruncate failed: %s", strerror(errno)); + return 0; + } store->table = (struct uuid_table *)mmap(NULL, TABLE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, store->shmfd, 0); if (store->table == NULL)