fix build warning 62/61862/4 accepted/tizen/common/20160315.220629 accepted/tizen/ivi/20160313.114411 accepted/tizen/mobile/20160313.113304 accepted/tizen/tv/20160313.113624 accepted/tizen/wearable/20160313.114027 submit/tizen/20160311.052143
authorJiwoong Im <jiwoong.im@samsung.com>
Fri, 11 Mar 2016 04:19:28 +0000 (13:19 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Fri, 11 Mar 2016 05:16:36 +0000 (21:16 -0800)
- warning: passing argument 1 of 'gdbm_open' discards 'const' qualifier
from pointer target type

Change-Id: Ib9ec7b0e34027ffccd25f9efd5c6244d238bb791
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
backend/gdbm.c

index 1525166..c893779 100644 (file)
@@ -55,18 +55,18 @@ static GDBM_FILE open_gdbm(const char *dbpath)
        if (db)
                return db;
 
-       db = gdbm_open(dbpath, 0, GDBM_WRCREAT, S_IRUSR | S_IWUSR, NULL);
+       nm = strdup(dbpath);
+       if (!nm) {
+               errno = ENOMEM;
+               return NULL;
+       }
+
+       db = gdbm_open(nm, 0, GDBM_WRCREAT, S_IRUSR | S_IWUSR, NULL);
        if (!db) {
                bxt_err("Open '%s' failed: %s", dbpath,
                                gdbm_strerror(gdbm_errno));
                errno = EIO;
-               return NULL;
-       }
-
-       nm = strdup(dbpath);
-       if (!nm) {
-               gdbm_close(db);
-               errno = ENOMEM;
+               free(nm);
                return NULL;
        }