summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-04-01 13:02:03 +0200
committerThomas Haller <thaller@redhat.com>2020-04-01 17:12:18 +0200
commit2e4771be5efb2b0e6820243929e55f4bf42c7cad (patch)
tree9825d60f3038d95020a50cd7bafc103d8c1a66e1
parentd506823d4f21f67d2c388e79982ebac170bce3e3 (diff)
downloadNetworkManager-2e4771be5efb2b0e6820243929e55f4bf42c7cad.tar.gz
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.
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index 0dc8894080..f337d0d4d0 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -550,16 +550,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) {