mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
lvmcmdline: restore digit check
Commit 9b4b5d449ef7045d33b8d8d7e69011d16f4bb8ab 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:
parent
fde23f7ce1
commit
864017710c
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user