]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
utils: fix parse_byte_size_string() coding style 2315/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 11 May 2018 11:08:20 +0000 (13:08 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 11 May 2018 11:08:20 +0000 (13:08 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
doc/lxc.container.conf.sgml.in
src/lxc/utils.c

index 50fa76789f2b935af10cefeff96eae9e57cbc674..4b2183435abbb8344d0c092af6a808bf4d63dcbc 100644 (file)
@@ -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>
@@ -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
index b7651d05588689c22ccba45fcbcdc320a1b861de..a734b3d6c48b86a31aebe52d6c7ccb9e6f046b0f 100644 (file)
@@ -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;