summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-05-09 21:38:11 +0200
committerThomas Haller <thaller@redhat.com>2022-06-07 09:55:39 +0200
commitfb2b35b0680f1a8068db88c4d5e3ffebfb76a62d (patch)
treefaa0868f209751ad112044f34c038980c9f1108e
parent8c6d89f9370a69b59391ae858851a9becb2e4708 (diff)
downloadNetworkManager-fb2b35b0680f1a8068db88c4d5e3ffebfb76a62d.tar.gz
ifcfg: set errno for svGetValueEnum() to detect unset values
-rw-r--r--src/core/settings/plugins/ifcfg-rh/shvar.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/settings/plugins/ifcfg-rh/shvar.c b/src/core/settings/plugins/ifcfg-rh/shvar.c
index 2ca495588b..fe8187c395 100644
--- a/src/core/settings/plugins/ifcfg-rh/shvar.c
+++ b/src/core/settings/plugins/ifcfg-rh/shvar.c
@@ -1328,6 +1328,7 @@ svGetValueEnum(shvarFile *s, const char *key, GType gtype, int *out_value, GErro
if (!svalue) {
/* don't touch out_value. The caller is supposed
* to initialize it with the default value. */
+ errno = ENOENT;
return TRUE;
}
@@ -1339,10 +1340,12 @@ svGetValueEnum(shvarFile *s, const char *key, GType gtype, int *out_value, GErro
err_token,
svalue,
key);
+ errno = EINVAL;
return FALSE;
}
NM_SET_OUT(out_value, value);
+ errno = 0;
return TRUE;
}