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 <bryce@osg.samsung.com>

Reviewers: zmike

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2156
This commit is contained in:
Bryce Harrington 2015-03-13 20:26:24 -04:00 committed by Mike Blumenkrantz
parent 0ddedd09a4
commit f4cb6a398b
1 changed files with 10 additions and 1 deletions

View File

@ -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)