diff options
author | Bryce Harrington <bryce@osg.samsung.com> | 2016-07-12 16:51:27 -0700 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2016-07-12 18:46:13 -0700 |
commit | 375759e63602a4fd580bb7c9dcfe2770c3c25971 (patch) | |
tree | eea55fb5d12722dddf4f9a6940145a5bedf1ac38 /shared/config-parser.c | |
parent | 1dbdc0bd8a1b9cedda12571c44c5068cecaa5d26 (diff) |
Require base-10 for strtol() calls
The third arg to strtol() specifies the base to assume for the number.
When 0 is passed, as is currently done in option-parser.c, hexadecimal
and octal numbers are permitted and automatically detected and
converted.
This change is an expansion of f6051cbab84c0e577473b67f0585c0f329eb80fe
to cover the remaining strtol() calls in Weston, where the routine is
being used to read fds and pids - which are always expressed in base-10.
It also changes the calls in config-parser, used by
weston_config_section_get_int(), which in turn is being used to read
scales, sizes, times, rates, and delays; these are all expressed in
base-10 numbers only.
The benefit of limiting this to base-10 is to eliminate surprises when
parsing numbers from the command line. Also, by making the code
consistent with other usages of strtol, it may make it possible to
factor out the common code in the future.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'shared/config-parser.c')
-rw-r--r-- | shared/config-parser.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/shared/config-parser.c b/shared/config-parser.c index 247e8801..4c672206 100644 --- a/shared/config-parser.c +++ b/shared/config-parser.c @@ -170,7 +170,7 @@ weston_config_section_get_int(struct weston_config_section *section, } errno = 0; - *value = strtol(entry->value, &end, 0); + *value = strtol(entry->value, &end, 10); if (errno != 0 || end == entry->value || *end != '\0') { *value = default_value; errno = EINVAL; |