Commit b0ec887d authored by Daniel Salzman's avatar Daniel Salzman

confio: a better implementation of c3f4368d

parent eee274c8
......@@ -20,7 +20,7 @@
#include "knot/conf/confio.h"
#include "knot/conf/tools.h"
#define FCN(io) (io->fcn != NULL) ? io->fcn(io) : io->error.code;
#define FCN(io) (io->fcn != NULL) ? io->fcn(io) : KNOT_EOK;
static void io_reset_val(
conf_io_t *io,
......@@ -1348,7 +1348,11 @@ static int check_section(
check_section_error:
io->error.str = args.err_str;
return FCN(io);
int ret = FCN(io);
if (ret == KNOT_EOK) {
return io->error.code;
}
return ret;
}
static int check_iter_section(
......
......@@ -1399,6 +1399,10 @@ static int ctl_conf_txn(ctl_args_t *args, ctl_cmd_t cmd)
// First check the database.
ret = conf_io_check(&io);
if (ret != KNOT_EOK) {
// A semantic error is already sent by the check function.
if (io.error.code != KNOT_EOK) {
return KNOT_EOK;
}
// No transaction abort!
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment