btrfs-progs: qgroup limit: add a check for invalid input of 'T/G/M/K'

Add a check to error out in the following case:

 # ./btrfs qgroup limit  T /mnt/
Invalid size argument given

Without this patch, btrfs-progs would parse the input as 0
and continue.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
Dongsheng Yang 2015-06-03 17:27:04 +08:00 committed by David Sterba
parent d9fd7cc0f5
commit d91f5ef091

View File

@ -121,6 +121,9 @@ static int parse_limit(const char *p, unsigned long long *s)
return 0;
size = strtoull(p, &endptr, 10);
if (p == endptr)
return 0;
switch (*endptr) {
case 'T':
case 't':