From: James Jones Date: Wed, 22 Jun 2022 21:09:20 +0000 (-0500) Subject: Set *err to -2 when the list isn't found in tmp_dcursor_init() (#4571) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0e1e00bd3d094d4971395331e8d40b7ae47583a;p=thirdparty%2Ffreeradius-server.git Set *err to -2 when the list isn't found in tmp_dcursor_init() (#4571) This change honors the comments describing how err is handled, and also means, given tmpl_find_vp()'s use of tmpl_dcursor_init(), means callers of tmpl_find_vp() can check its return value rather than having to look at the written vp (e.g. sometimes_return(); see CID #1503995). --- diff --git a/src/lib/server/tmpl_dcursor.c b/src/lib/server/tmpl_dcursor.c index eeb126265b2..9bdcfdb4004 100644 --- a/src/lib/server/tmpl_dcursor.c +++ b/src/lib/server/tmpl_dcursor.c @@ -373,6 +373,7 @@ fr_pair_t *tmpl_dcursor_init(int *err, TALLOC_CTX *ctx, tmpl_dcursor_ctx_t *cc, if (!list_head) { fr_strerror_printf("List \"%s\" not available in this context", fr_table_str_by_value(pair_list_table, tmpl_list(vpt), "")); + if (err) *err = -2; goto error; } list_ctx = tmpl_list_ctx(request, tmpl_list(vpt));