diff options
author | David Lamparter <equinox@diac24.net> | 2021-03-26 14:27:51 +0100 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2021-03-30 22:34:56 +0200 |
commit | 2c12c904ea34b96098f2390f97921ba89b40cb19 (patch) | |
tree | 582d6e3a287b4432c788878b698b4a320887e2ce | |
parent | lib: add `%dPF` & `%dSO` formats (diff) | |
download | frr-2c12c904ea34b96098f2390f97921ba89b40cb19.tar.xz frr-2c12c904ea34b96098f2390f97921ba89b40cb19.zip |
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>
Diffstat (limited to '')
-rw-r--r-- | lib/vty.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -159,6 +159,8 @@ int vty_out(struct vty *vty, const char *format, ...) char buf[1024]; char *p = NULL; char *filtered; + /* format string may contain %m, keep errno intact for printfrr */ + int saved_errno = errno; if (vty->frame_pos) { vty->frame_pos = 0; @@ -166,6 +168,7 @@ int vty_out(struct vty *vty, const char *format, ...) } va_start(args, format); + errno = saved_errno; p = vasnprintfrr(MTYPE_VTY_OUT_BUF, buf, sizeof(buf), format, args); va_end(args); |