diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2015-11-18 15:19:06 +0100 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2015-11-18 15:19:06 +0100 |
commit | fb6324eb165d1577bc4541bc2fc6758c56da2a95 (patch) | |
tree | afbc98168e056e7839ac0dc434db8f88ffb34833 /src/libstrongswan/settings/settings.c | |
parent | ea6a577e967da0ee954b06b7bdc6796e97eb9b2b (diff) | |
parent | 1e980d6be0ef0e243c6fe82b5e855454b97e24a4 (diff) | |
download | vyos-strongswan-fb6324eb165d1577bc4541bc2fc6758c56da2a95.tar.gz vyos-strongswan-fb6324eb165d1577bc4541bc2fc6758c56da2a95.zip |
Merge tag 'upstream/5.3.4'
Upstream version 5.3.4
Diffstat (limited to 'src/libstrongswan/settings/settings.c')
-rw-r--r-- | src/libstrongswan/settings/settings.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libstrongswan/settings/settings.c b/src/libstrongswan/settings/settings.c index 305ebe620..56cc2f19b 100644 --- a/src/libstrongswan/settings/settings.c +++ b/src/libstrongswan/settings/settings.c @@ -540,6 +540,31 @@ METHOD(settings_t, get_int, int, /** * Described in header */ +inline u_int64_t settings_value_as_uint64(char *value, u_int64_t def) +{ + u_int64_t intval; + char *end; + int base = 10; + + if (value) + { + errno = 0; + if (value[0] == '0' && value[1] == 'x') + { /* manually detect 0x prefix as we want to avoid octal encoding */ + base = 16; + } + intval = strtoull(value, &end, base); + if (errno == 0 && *end == 0 && end != value) + { + return intval; + } + } + return def; +} + +/** + * Described in header + */ inline double settings_value_as_double(char *value, double def) { double dval; |