diff --git a/tools/xl/xl.c b/tools/xl/xl.c index 4107d10fd4..f422f9fed5 100644 --- a/tools/xl/xl.c +++ b/tools/xl/xl.c @@ -80,14 +80,20 @@ static int auto_autoballoon(void) if (!info) return 1; /* default to on */ +#define SIZE_PATTERN "-?[0-9]+[bBkKmMgGtT]?" + ret = regcomp(®ex, - "(^| )dom0_mem=((|min:|max:)[0-9]+[bBkKmMgG]?,?)+($| )", + "(^| )dom0_mem=((|min:|max:)(" SIZE_PATTERN "|(" SIZE_PATTERN "\\+)?[0-9]{1,2}%),?)+($| )", REG_NOSUB | REG_EXTENDED); + +#undef SIZE_PATTERN + if (ret) return 1; ret = regexec(®ex, info->commandline, 0, NULL, 0); regfree(®ex); + return ret == REG_NOMATCH; }