discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=f4cb6a398b26cc078f6aa8d5c30f707d6e258749

commit f4cb6a398b26cc078f6aa8d5c30f707d6e258749
Author: Bryce Harrington <br...@osg.samsung.com>
Date:   Fri Mar 13 20:26:24 2015 -0400

    uuid: Check error on ftruncate call
    
    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 <br...@osg.samsung.com>
    
    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 e5f65c2..c21534c 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)

-- 


Reply via email to