blob: 315bf7b6651242f0a9efafc0868450ef445d43d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <db.h>
static const char *DB_FILE = "nserver.db";
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);
check(gf != NULL, "unable to init db");
// Close the DB.
int rc = gdbm_close(gf);
check(rc == 0, "error closing db after init");
return 0;
error:
return -1;
}
|