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@xxxxxxxxxxxxxx>
---
cmds-qgroup.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/cmds-qgroup.c b/cmds-qgroup.c
index 5ea4021..9545a20 100644
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -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':
--
1.8.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html