ll-database-binding: allow binding to build with older gdbm libraries 09/13309/1
authorMatt Ranostay <matt.ranostay@konsulko.com>
Tue, 30 Jan 2018 18:55:28 +0000 (10:55 -0800)
committerMatt Ranostay <matt.ranostay@konsulko.com>
Tue, 30 Jan 2018 20:58:36 +0000 (12:58 -0800)
Due to GPLv3 compliance the binding needs to be buildable with older versions
of gdbm <= 1.8.3

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
ll-database-binding/src/persistence-binding.c

index e16b93b..b6ec8d1 100644 (file)
@@ -186,7 +186,7 @@ static int xdb_open(const char *path)
        if (!database)
        {
                AFB_ERROR("Fail to open/create database: %s%s%s",
        if (!database)
        {
                AFB_ERROR("Fail to open/create database: %s%s%s",
-                       gdbm_errlist[gdbm_errno],
+                       gdbm_strerror(gdbm_errno),
                        IFSYS(", ", ""),
                        IFSYS(strerror(errno), ""));
                return -1;
                        IFSYS(", ", ""),
                        IFSYS(strerror(errno), ""));
                return -1;
@@ -208,10 +208,10 @@ static void xdb_put(struct afb_req req, datum *key, datum *data, int replace)
                        replace ? "replace" : "insert",
                        DATA_STR(*key),
                        DATA_STR(*data),
                        replace ? "replace" : "insert",
                        DATA_STR(*key),
                        DATA_STR(*data),
-                       gdbm_errlist[gdbm_errno],
+                       gdbm_strerror(gdbm_errno),
                        IFSYS(", ", ""),
                        IFSYS(strerror(errno), ""));
                        IFSYS(", ", ""),
                        IFSYS(strerror(errno), ""));
-               afb_req_fail_f(req, "failed", "%s", ret > 0 ? "key already exists" : gdbm_errlist[gdbm_errno]);
+               afb_req_fail_f(req, "failed", "%s", ret > 0 ? "key already exists" : gdbm_strerror(gdbm_errno));
        }
 }
 
        }
 }
 
@@ -226,10 +226,10 @@ static void xdb_delete(struct afb_req req, datum *key)
        {
                AFB_ERROR("can't delete key %s: %s%s%s",
                        DATA_STR(*key),
        {
                AFB_ERROR("can't delete key %s: %s%s%s",
                        DATA_STR(*key),
-                       gdbm_errlist[gdbm_errno],
+                       gdbm_strerror(gdbm_errno),
                        IFSYS(", ", ""),
                        IFSYS(strerror(errno), ""));
                        IFSYS(", ", ""),
                        IFSYS(strerror(errno), ""));
-               afb_req_fail_f(req, "failed", "%s", gdbm_errlist[gdbm_errno]);
+               afb_req_fail_f(req, "failed", "%s", gdbm_strerror(gdbm_errno));
        }
 }
 
        }
 }
 
@@ -250,10 +250,10 @@ static void xdb_get(struct afb_req req, datum *key)
        {
                AFB_ERROR("can't get key %s: %s%s%s",
                        DATA_STR(*key),
        {
                AFB_ERROR("can't get key %s: %s%s%s",
                        DATA_STR(*key),
-                       gdbm_errlist[gdbm_errno],
+                       gdbm_strerror(gdbm_errno),
                        IFSYS(", ", ""),
                        IFSYS(strerror(errno), ""));
                        IFSYS(", ", ""),
                        IFSYS(strerror(errno), ""));
-               afb_req_fail_f(req, "failed", "%s", gdbm_errlist[gdbm_errno]);
+               afb_req_fail_f(req, "failed", "%s", gdbm_strerror(gdbm_errno));
        }
 }
 #endif
        }
 }
 #endif