From ed1454e85281cbabe6821b370decaee26b919dc3 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Tue, 8 Dec 2020 12:19:04 +0100 Subject: [PATCH] confile: clean up hooks Signed-off-by: Christian Brauner --- src/lxc/confile.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 90b52f7a4..e7ab35929 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -1186,10 +1186,8 @@ static int set_config_hooks(const char *key, const char *value, if (lxc_config_value_empty(value)) return lxc_clear_hooks(lxc_conf, key); - if (strcmp(key + 4, "hook") == 0) { - ERROR("lxc.hook must not have a value"); - return -1; - } + if (strcmp(key + 4, "hook") == 0) + return log_error_errno(-EINVAL, EINVAL, "lxc.hook must not have a value"); copy = strdup(value); if (!copy) @@ -1232,11 +1230,9 @@ static int set_config_hooks_version(const char *key, const char *value, if (ret < 0) return -1; - if (tmp > 1) { - ERROR("Invalid hook version specified. Currently only 0 " - "(legacy) and 1 are supported"); - return -1; - } + if (tmp > 1) + return log_error_errno(-EINVAL, + EINVAL, "Invalid hook version specified. Currently only 0 (legacy) and 1 are supported"); lxc_conf->hooks_version = tmp; -- 2.47.2