]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: assert for VTY_PASSFD expectations 14484/head
authorDavid Lamparter <equinox@opensourcerouting.org>
Sun, 24 Sep 2023 18:12:42 +0000 (20:12 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sun, 24 Sep 2023 18:14:37 +0000 (20:14 +0200)
Coverity is complaining that vty->state could be VTY_PASSFD here.  It
can't, it really shouldn't, and if it actually is then something went
seriously wrong somewhere earlier so assert()ing out is the best thing
to do.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/vty.c

index 8f8effa9ccc0ac2db4b2fb8f76a45253875c18d5..15cc340eb0c5bb0140ebc27ea88d034194bea95f 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2386,9 +2386,14 @@ static void vtysh_read(struct event *thread)
                                         * => skip vty_event(VTYSH_READ, vty)!
                                         */
                                        return;
-                               } else
+                               } else {
+                                       assertf(vty->status != VTY_PASSFD,
+                                               "%p address=%s passfd=%d", vty,
+                                               vty->address, vty->pass_fd);
+
                                        /* normalize other invalid values */
                                        vty->pass_fd = -1;
+                               }
 
                                /* hack for asynchronous "write integrated"
                                 * - other commands in "buf" will be ditched