ifcfg: set errno for svGetValueEnum() to detect unset values

This commit is contained in:
Thomas Haller 2022-05-09 21:38:11 +02:00
parent 8c6d89f937
commit fb2b35b068
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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;
}