1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 10:25:13 +03:00

lvmcmdline: restore digit check

Commit 9b4b5d449e started to accept
rather way to wide set of strings we do not want to take for size.
i.e.  lvresize -t vg0/lvol0 -LNaNM

Restore check for 'digit ||  locales defined 'dot' |  '.'
(as we tend to take '.' even if locales uses ',')
This commit is contained in:
Zdenek Kabelac 2017-07-17 20:36:39 +02:00
parent fde23f7ce1
commit 864017710c

View File

@ -32,6 +32,7 @@
#include <dirent.h>
#include <paths.h>
#include <locale.h>
#include <langinfo.h>
#ifdef HAVE_VALGRIND
#include <valgrind.h>
@ -543,6 +544,7 @@ static int _size_arg(struct cmd_context *cmd __attribute__((unused)),
char *val;
double v;
uint64_t v_tmp, adjustment;
char *radixchar = nl_langinfo(RADIXCHAR);
av->percent = PERCENT_NONE;
@ -565,6 +567,14 @@ static int _size_arg(struct cmd_context *cmd __attribute__((unused)),
return 0;
}
if (!isdigit(*val) &&
(*val != '.') &&
(radixchar && (*val != radixchar[0]))) {
log_error("Size requires number argument.");
return 0;
}
errno = 0;
v = strtod(val, &ptr);