]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: fix uninit value when handling bgp read errs
authorQuentin Young <qlyoung@nvidia.com>
Thu, 15 Apr 2021 22:05:10 +0000 (18:05 -0400)
committerQuentin Young <qlyoung@nvidia.com>
Thu, 15 Apr 2021 22:07:44 +0000 (18:07 -0400)
Compiler warns about uninitialized value, although in practice it is
unreachable.

Also updates a function comment explaining what that value does.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
bgpd/bgp_io.c

index a696d956977aba5b4fc05bd52c5af5d9e88d668f..c2d8cae580d241b252e1524b1e01798a58370369 100644 (file)
@@ -180,8 +180,8 @@ static int bgp_process_reads(struct thread *thread)
        bool more = true;               // whether we got more data
        bool fatal = false;             // whether fatal error occurred
        bool added_pkt = false;         // whether we pushed onto ->ibuf
+       int code = 0;                   // FSM code if error occurred
        /* clang-format on */
-       int code;
 
        peer = THREAD_ARG(thread);
 
@@ -455,6 +455,9 @@ done : {
 /*
  * Reads a chunk of data from peer->fd into peer->ibuf_work.
  *
+ * code_p
+ *    Pointer to location to store FSM event code in case of fatal error.
+ *
  * @return status flag (see top-of-file)
  */
 static uint16_t bgp_read(struct peer *peer, int *code_p)