radcli_avp_list_error(3)

radcli_avp_list_error3

Check whether any radcli_avp_add_*()/_by_num() call on list has ever failed.

Usage

#include <radcli/>

int radcli_avp_list_error(
    const radcli_avp_list  *list
);

Overview

Once any add call on a given list fails, the list remembers it (sticky the first failure, not just the most recent). This lets a caller build a whole request as a flat sequence of add calls with no per-call check, then check once, here, before sending instead of the ~6-line "if (radcli_avp_add_...(...) != 0) { log; abort; }" block repeated at every call site, which has only one realistic recovery action (abort the whole request) regardless of which attribute failed to add.

Purely observational: it does not change any radcli_avp_add_*()'s own behavior. Every add call is attempted and returns its own 0/-1 exactly as it would without this function existing, even after an earlier add on the same list has already failed a caller checking each call individually (or deliberately testing that one bad attribute is rejected before adding others, as tests/avp.c does) sees no difference. This function only adds a second, aggregate way to notice a failure that already happened, for a caller that would rather check once than at every call site.

Parameters

list

the list to check; NULL counts as an error (nothing to build onto), matching how every radcli_avp_add_*() already treats a NULL list as failure so a caller does not need a separate if (list == NULL) check right after radcli_avp_list_new() before relying on this.

Return value

non-zero if list is NULL or any add call on it has ever failed, 0 otherwise.

From radcli 2.0.1-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.