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

index 05464a24910c4bd686eef04eb8a1a516fc631828..8eb52a70928bf4793f044bd7d1bbb11eb3ec5692 100644 (file)
@@ -2395,29 +2395,26 @@ static int set_config_console_size(const char *key, const char *value,
        }
 
        ret = parse_byte_size_string(value, &size);
-       if (ret < 0)
-               return -1;
+       if (ret)
+               return ret_errno(EINVAL);
 
        if (size < 0)
-               return -EINVAL;
+               return ret_errno(EINVAL);
 
        /* must be at least a page size */
        pgsz = lxc_getpagesize();
        if ((uint64_t)size < pgsz) {
-               NOTICE("Requested ringbuffer size for the console is %" PRId64
-                      " but must be at least %" PRId64
-                      " bytes. Setting ringbuffer size to %" PRId64 " bytes",
+               NOTICE("Requested ringbuffer size for the console is %" PRId64 " but must be at least %" PRId64 " bytes. Setting ringbuffer size to %" PRId64 " bytes",
                       size, pgsz, pgsz);
                size = pgsz;
        }
 
        log_size = lxc_find_next_power2((uint64_t)size);
        if (log_size == 0)
-               return -EINVAL;
+               return ret_errno(EINVAL);
 
        if (log_size != size)
-               NOTICE("Passed size was not a power of 2. Rounding log size to "
-                      "next power of two: %" PRIu64 " bytes", log_size);
+               NOTICE("Passed size was not a power of 2. Rounding log size to next power of two: %" PRIu64 " bytes", log_size);
 
        lxc_conf->console.log_size = log_size;