]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: clean up hooks 3594/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 8 Dec 2020 11:19:04 +0000 (12:19 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 8 Dec 2020 11:19:04 +0000 (12:19 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index 90b52f7a413e8995ff64d4a502995945f7a7fbd3..e7ab3592915df0a4f45e07a43fedfdaf22ad152d 100644 (file)
@@ -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;