summaryrefslogtreecommitdiffstats
path: root/misc/arpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc/arpd.c')
-rw-r--r--misc/arpd.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/misc/arpd.c b/misc/arpd.c
index 1ef837c..65ac6a3 100644
--- a/misc/arpd.c
+++ b/misc/arpd.c
@@ -19,6 +19,7 @@
#include <fcntl.h>
#include <sys/uio.h>
#include <sys/socket.h>
+#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include <signal.h>
@@ -35,7 +36,8 @@
#include "rt_names.h"
DB *dbase;
-char *dbname = "/var/lib/arpd/arpd.db";
+char const default_dbname[] = ARPDDIR "/arpd.db";
+char const *dbname = default_dbname;
int ifnum;
int *ifvec;
@@ -668,6 +670,13 @@ int main(int argc, char **argv)
}
}
+ if (strcmp(default_dbname, dbname) == 0) {
+ if (mkdir(ARPDDIR, 0755) != 0 && errno != EEXIST) {
+ perror("create_db_dir");
+ exit(-1);
+ }
+ }
+
dbase = dbopen(dbname, O_CREAT|O_RDWR, 0644, DB_HASH, NULL);
if (dbase == NULL) {
perror("db_open");