From fb2b35b0680f1a8068db88c4d5e3ffebfb76a62d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 9 May 2022 21:38:11 +0200 Subject: ifcfg: set errno for svGetValueEnum() to detect unset values --- src/core/settings/plugins/ifcfg-rh/shvar.c | 3 +++ 1 file changed, 3 insertions(+) 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; } -- cgit v1.2.1