mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmcmdline: extra support for decimal point
If root has locales with different decimal point then '.' (i.e. Czech with ',') lets be tolerant and retry with "C" locales in the case '.' is found during parse of number. Locales are then restored back.
This commit is contained in:
parent
97cccfbf1c
commit
519fbe71e4
@ -1,5 +1,6 @@
|
||||
Version 2.02.112 -
|
||||
=====================================
|
||||
Add extra support for '.' as decimal point in size args.
|
||||
Configurable support for creation of sparse volumes with thin-pools.
|
||||
Update and correct lvcreate and lvcovert man pages.
|
||||
Mark pools and snapshots as unzeroable volumes.
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <sys/resource.h>
|
||||
#include <dirent.h>
|
||||
#include <paths.h>
|
||||
#include <locale.h>
|
||||
|
||||
#ifdef HAVE_GETOPTLONG
|
||||
# include <getopt.h>
|
||||
@ -414,6 +415,17 @@ static int _size_arg(struct cmd_context *cmd __attribute__((unused)), struct arg
|
||||
|
||||
v = strtod(val, &ptr);
|
||||
|
||||
if (*ptr == '.') {
|
||||
/*
|
||||
* Maybe user has non-C locale with different decimal point ?
|
||||
* Lets be toleran and retry with standard C locales
|
||||
*/
|
||||
if (setlocale(LC_ALL, "C")) {
|
||||
v = strtod(val, &ptr);
|
||||
setlocale(LC_ALL, "");
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr == val)
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user