]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/ferr.c
*: fix config.h/zebra.h include order
[mirror_frr.git] / lib / ferr.c
index d1b9d514b468e8d7d63159644d0b68e3ef0efa38..afef196cec4ce3cfac14fdc7af747b28eabc91c0 100644 (file)
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
@@ -107,7 +111,7 @@ struct log_ref *log_ref_get(uint32_t code)
 void log_ref_display(struct vty *vty, uint32_t code, bool json)
 {
        struct log_ref *ref;
-       struct json_object *top, *obj;
+       struct json_object *top = NULL, *obj = NULL;
        struct list *errlist;
        struct listnode *ln;
 
@@ -148,7 +152,7 @@ void log_ref_display(struct vty *vty, uint32_t code, bool json)
                        snprintf(pbuf, sizeof(pbuf), "\nError %"PRIu32" - %s",
                                 ref->code, ref->title);
                        memset(ubuf, '=', strlen(pbuf));
-                       ubuf[sizeof(ubuf) - 1] = '\0';
+                       ubuf[strlen(pbuf)] = '\0';
 
                        vty_out(vty, "%s\n%s\n", pbuf, ubuf);
                        vty_out(vty, "Description:\n%s\n\n", ref->description);