]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: cleanup set_config_console_rotate()
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 8 Dec 2020 14:49:31 +0000 (15:49 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 8 Dec 2020 15:49:39 +0000 (16:49 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index 2f04cedf0d18eb01d11c1d4729ef0500e1db6482..f65ac70836d4b53e8c9f711091e568e17da7fbd0 100644 (file)
@@ -2308,19 +2308,19 @@ static int set_config_console_path(const char *key, const char *value,
 static int set_config_console_rotate(const char *key, const char *value,
                                     struct lxc_conf *lxc_conf, void *data)
 {
+       int ret;
+
        if (lxc_config_value_empty(value)) {
                lxc_conf->console.log_rotate = 0;
                return 0;
        }
 
-       if (lxc_safe_uint(value, &lxc_conf->console.log_rotate) < 0)
-               return -1;
+       ret = lxc_safe_uint(value, &lxc_conf->console.log_rotate);
+       if (ret)
+               return ret_errno(EINVAL);
 
-       if (lxc_conf->console.log_rotate > 1) {
-               ERROR("The \"lxc.console.rotate\" config key can only be set "
-                     "to 0 or 1");
-               return -1;
-       }
+       if (lxc_conf->console.log_rotate > 1)
+               return log_error_errno(-EINVAL, EINVAL, "The \"lxc.console.rotate\" config key can only be set to 0 or 1");
 
        return 0;
 }