diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2021-09-29 14:35:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-29 14:35:35 +0200 |
| commit | a89bae26f78c00080ecc48c4dbbd86c2ceafb547 (patch) | |
| tree | 54e3465415786cf3535813fa0f49082d933cca20 /lib/libfrr.c | |
| parent | ffd7467cc43a0593b21cbf7e62d4fdb1ff8688e7 (diff) | |
| parent | 52fad8f6563080c64b5609f8b357ed47b1dfb78c (diff) | |
Merge pull request #9560 from LabNConsulting/ziemba/frrmod_load-error-messages
frrmod_load(): fix error messages
Diffstat (limited to 'lib/libfrr.c')
| -rw-r--r-- | lib/libfrr.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c index d03437328b..9b05bb4fbf 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -674,13 +674,19 @@ static void frr_mkdir(const char *path, bool strip) strerror(errno)); } +static void _err_print(const void *cookie, const char *errstr) +{ + const char *prefix = (const char *)cookie; + + fprintf(stderr, "%s: %s\n", prefix, errstr); +} + static struct thread_master *master; struct thread_master *frr_init(void) { struct option_chain *oc; struct frrmod_runtime *module; struct zprivs_ids_t ids; - char moderr[256]; char p_instance[16] = "", p_pathspace[256] = ""; const char *dir; dir = di->module_path ? di->module_path : frr_moduledir; @@ -734,11 +740,9 @@ struct thread_master *frr_init(void) frrmod_init(di->module); while (modules) { modules = (oc = modules)->next; - module = frrmod_load(oc->arg, dir, moderr, sizeof(moderr)); - if (!module) { - fprintf(stderr, "%s\n", moderr); + module = frrmod_load(oc->arg, dir, _err_print, __func__); + if (!module) exit(1); - } XFREE(MTYPE_TMP, oc); } |
