Skip to content
Snippets Groups Projects
Commit 61e68f8d authored by David Vasek's avatar David Vasek
Browse files

src: replace mkdir() with make_dir() where suitable

A cleaner solution, but not necessary since the code will fail later for ENOTDIR anyway.
parent f1be13a5
No related branches found
No related tags found
1 merge request!1293add new filters to "zone-backup"/"zone-restore" that allow detailed selection of backup/restore components
/* Copyright (C) 2020 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -22,6 +22,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include "contrib/files.h"
#include "contrib/wire_ctx.h"
#include "libknot/dname.h"
#include "libknot/endian.h"
......@@ -140,9 +141,9 @@ static int lmdb_open(knot_lmdb_db_t *db)
return ret;
}
ret = mkdir(db->path, LMDB_DIR_MODE);
if (ret < 0 && errno != EEXIST) {
return -errno;
ret = make_dir(db->path, LMDB_DIR_MODE, true);
if (ret != KNOT_EOK) {
return ret;
}
long page_size = sysconf(_SC_PAGESIZE);
......
/* Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -24,6 +24,7 @@
#include "libknot/attribute.h"
#include "libknot/errcode.h"
#include "libknot/db/db_lmdb.h"
#include "contrib/files.h"
#include "contrib/mempattern.h"
#include <lmdb.h>
......@@ -79,12 +80,7 @@ static int lmdb_error_to_knot(int error)
static int create_env_dir(const char *path)
{
int r = mkdir(path, LMDB_DIR_MODE);
if (r == -1 && errno != EEXIST) {
return lmdb_error_to_knot(errno);
}
return KNOT_EOK;
return make_dir(path, LMDB_DIR_MODE, true);
}
/*! \brief Set the environment map size.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment