summaryrefslogtreecommitdiffstats
path: root/ll-database-binding/src
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-10-24 16:28:01 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-10-24 16:28:01 +0200
commit571037e94bd01aafc7a17b8781e836d3fd9add22 (patch)
treeb5b8699a3b1e257efea96b7f9446556bc2cdabcf /ll-database-binding/src
parent8aee021fff7a128db22bb6f9d97827f009014828 (diff)
database: return -1 when init fails
Change-Id: Ica032ca1de51c8ec47eb543eda762b8ae70b2895 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'll-database-binding/src')
-rw-r--r--ll-database-binding/src/ll-database-binding.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ll-database-binding/src/ll-database-binding.c b/ll-database-binding/src/ll-database-binding.c
index d1e7bf5..896c76d 100644
--- a/ll-database-binding/src/ll-database-binding.c
+++ b/ll-database-binding/src/ll-database-binding.c
@@ -72,7 +72,7 @@ int ll_database_binding_init()
{
if (ret == 0) AFB_ERROR("User not found");
else AFB_ERROR("getpwuid_r failed with %d code", ret);
- return ret ? ret : -1;
+ return -1;
}
memset(database_file, 0, MAX_PATH);
@@ -84,14 +84,14 @@ int ll_database_binding_init()
if ((ret = db_create(&database, NULL, 0)) != 0)
{
AFB_ERROR("Failed to create database: %s.", db_strerror(ret));
- return 1;
+ return -1;
}
if ((ret = database->open(database, NULL, database_file, NULL, DB_BTREE, DB_CREATE, 0664)) != 0)
{
AFB_ERROR("Failed to open the '%s' database: %s.", database_file, db_strerror(ret));
database->close(database, 0);
- return 1;
+ return -1;
}
return 0;