ifcfg: strip whitespaces around "DEVTIMEOUT"

Be more graceful and allow whitespaces around the floating point number
for DEVTIMEOUT. Note that _nm_utils_ascii_str_to_int64() is already graceful
against whitespace, so also be it with the g_ascii_strtod() code path.

(cherry picked from commit 2e4771be5e)
(cherry picked from commit 5a44792e41)
This commit is contained in:
Thomas Haller 2020-04-01 13:02:03 +02:00
parent 75933cd6ff
commit 396a4dfc2b
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -543,16 +543,18 @@ make_connection_setting (const char *file,
g_object_set (s_con, NM_SETTING_CONNECTION_AUTH_RETRIES, (int) vint64, NULL);
nm_clear_g_free (&value);
v = svGetValueStr (ifcfg, "DEVTIMEOUT", &value);
v = svGetValue (ifcfg, "DEVTIMEOUT", &value);
if (v) {
v = nm_str_skip_leading_spaces (v);
vint64 = _nm_utils_ascii_str_to_int64 (v, 10, 0, ((gint64) G_MAXINT32) / 1000, -1);
if (vint64 != -1)
vint64 *= 1000;
else {
else if (v[0] != '\0') {
char *endptr;
double d;
d = g_ascii_strtod (v, &endptr);
endptr = nm_str_skip_leading_spaces (endptr);
if ( errno == 0
&& endptr[0] == '\0'
&& d >= 0.0) {