Skip to content

Commit

Permalink
utils: fix parse_byte_size_string() coding style
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed May 11, 2018
1 parent 39ebeb7 commit 6d276ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions doc/lxc.container.conf.sgml.in
Expand Up @@ -828,7 +828,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
be a power of 2 when converted to bytes. Valid size prefixes are
'KB', 'MB', 'GB'. (Note that all conversions are based on multiples
of 1024. That means 'KB' == 'KiB', 'MB' == 'MiB', 'GB' == 'GiB'.
And ignored case, for example 'kB', 'KB' and 'Kb' is same.)
Additionally, the case of the suffix is ignored, i.e. 'kB', 'KB' and
'Kb' are treated equally.)
</para>
</listitem>
</varlistentry>
Expand All @@ -853,7 +854,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
be a power of 2 when converted to bytes. Valid size prefixes are
'KB', 'MB', 'GB'. (Note that all conversions are based on multiples
of 1024. That means 'KB' == 'KiB', 'MB' == 'MiB', 'GB' == 'GiB'.
And ignored case, for example 'kB', 'KB' and 'Kb' is same.)
Additionally, the case of the suffix is ignored, i.e. 'kB', 'KB' and
'Kb' are treated equally.)

If users want to mirror the console ringbuffer on disk they should set
<option>lxc.console.size</option> equal to
Expand Down
6 changes: 3 additions & 3 deletions src/lxc/utils.c
Expand Up @@ -2450,11 +2450,11 @@ int parse_byte_size_string(const char *s, int64_t *converted)
return 0;
}

if (!strcasecmp(suffix, "KB"))
if (strcasecmp(suffix, "KB") == 0)
mltpl = 1024;
else if (!strcasecmp(suffix, "MB"))
else if (strcasecmp(suffix, "MB") == 0)
mltpl = 1024 * 1024;
else if (!strcasecmp(suffix, "GB"))
else if (strcasecmp(suffix, "GB") == 0)
mltpl = 1024 * 1024 * 1024;
else
return -EINVAL;
Expand Down

0 comments on commit 6d276ed

Please sign in to comment.