X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=keydb_fs.c;h=a1529456548804a55efc02d98274e1d2c859f14c;hb=83ae316a7b14e55418349e87d1a1942a0627ae14;hp=9e072bab0f240e9205668c03769032711627e2a6;hpb=8e0907be1d73011075a99a0c029c56664e12843e;p=onak.git diff --git a/keydb_fs.c b/keydb_fs.c index 9e072ba..a152945 100644 --- a/keydb_fs.c +++ b/keydb_fs.c @@ -452,7 +452,7 @@ static struct ll *internal_get_key_by_word(char *word, struct ll *mct) d = opendir(buffer); logthing(LOGTHING_DEBUG, "Scanning for word %s in dir %s", word, buffer); - if (d) + if (d) { do { de = readdir(d); if (de && de->d_name[0] != '.') { @@ -470,7 +470,8 @@ static struct ll *internal_get_key_by_word(char *word, struct ll *mct) } } } while (de); - closedir(d); + closedir(d); + } return keys; } @@ -640,10 +641,9 @@ struct onak_dbctx *keydb_fs_init(bool readonly) privctx->lockfile_fd = open(buffer, O_RDWR | O_CREAT, 0600); } chdir(config.db_dir); - if (privctx->lockfile_fd == -1) - privctx->lockfile_fd = open(buffer, - (privctx->lockfile_readonly) ? - O_RDONLY : O_RDWR); + privctx->lockfile_fd = open(buffer, + (privctx->lockfile_readonly) ? + O_RDONLY : O_RDWR); if (privctx->lockfile_fd == -1) privctx->lockfile_fd = open(buffer, O_RDWR | O_CREAT, 0600); if (privctx->lockfile_fd == -1) {