]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: fix regcomp error processing
authorIgor Ryzhov <iryzhov@nfware.com>
Mon, 21 Sep 2020 12:35:56 +0000 (15:35 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Mon, 21 Sep 2020 12:35:56 +0000 (15:35 +0300)
 * use actual error code instead of "false"
 * add missing new line

Before:
```
nfware# show interface | include (a]
% Regex compilation error: Success% Bad regexp '(a]'
% Unknown command: show interface | include (a]
```

After:
```
nfware# show interface | include (a]
% Regex compilation error: Unmatched ( or \(
% Bad regexp '(a]'
% Unknown command: show interface | include (a]
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
lib/vty.c

index 184c7604b8090379f5a408b73a6f274d981652bb..077c6f62113f36fe29965b0a7671c81f9c202ecc 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -141,8 +141,8 @@ bool vty_set_include(struct vty *vty, const char *regexp)
                          REG_EXTENDED | REG_NEWLINE | REG_NOSUB);
        if (errcode) {
                ret = false;
-               regerror(ret, &vty->include, errbuf, sizeof(errbuf));
-               vty_out(vty, "%% Regex compilation error: %s", errbuf);
+               regerror(errcode, &vty->include, errbuf, sizeof(errbuf));
+               vty_out(vty, "%% Regex compilation error: %s\n", errbuf);
        } else {
                vty->filter = true;
        }