From: Christian Brauner Date: Tue, 8 Dec 2020 11:19:04 +0000 (+0100) Subject: confile: clean up hooks X-Git-Tag: lxc-5.0.0~333^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed1454e85281cbabe6821b370decaee26b919dc3;p=thirdparty%2Flxc.git confile: clean up hooks Signed-off-by: Christian Brauner --- 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;