nserver

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 83359274abde2c9422df10af2f7565396a08a757
parent 89919c902061006471760cbddd2fe275ff57c8d8
Author: rsiddharth <s@ricketyspace.net>
Date:   Sat, 11 Apr 2020 10:47:54 -0400

nserver: Update db_init.

* nserver/src/db.c (db_open): New function.
(db_init): Use db_open to get GDBM_FILE.

Diffstat:
nserver/src/db.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/nserver/src/db.c b/nserver/src/db.c @@ -3,11 +3,15 @@ static const char *DB_FILE = "nserver.db"; +GDBM_FILE db_open(int flags) +{ + return gdbm_open(DB_FILE, 0,flags, S_IRUSR|S_IWUSR, NULL); +} + int db_init() { // Create DB if it's not already created. - GDBM_FILE gf = gdbm_open(DB_FILE, 0, GDBM_WRCREAT, - S_IRUSR|S_IWUSR, NULL); + GDBM_FILE gf = db_open(GDBM_WRCREAT); check(gf != NULL, "unable to init db"); // Close the DB.