mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 12:39:21 +00:00
lib: save errno in vty_out()
... so `%m` works correctly, without us trampling over `errno` before we get to formatting it. Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
7b183fd8ea
commit
2c12c904ea
@ -159,6 +159,8 @@ int vty_out(struct vty *vty, const char *format, ...)
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
char *filtered;
|
char *filtered;
|
||||||
|
/* format string may contain %m, keep errno intact for printfrr */
|
||||||
|
int saved_errno = errno;
|
||||||
|
|
||||||
if (vty->frame_pos) {
|
if (vty->frame_pos) {
|
||||||
vty->frame_pos = 0;
|
vty->frame_pos = 0;
|
||||||
@ -166,6 +168,7 @@ int vty_out(struct vty *vty, const char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
|
errno = saved_errno;
|
||||||
p = vasnprintfrr(MTYPE_VTY_OUT_BUF, buf, sizeof(buf), format, args);
|
p = vasnprintfrr(MTYPE_VTY_OUT_BUF, buf, sizeof(buf), format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user