From 637b00caa8b128b7acf23ab2ae5f6dbbf40d2427 Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Wed, 29 May 2019 14:43:24 +0200 Subject: [PATCH 1/2] isisd: Remove warning about shadowing a variable There is no need to redefine `struct isis_lsp *lsp` inside of the if condition. Let's just remove it. Signed-off-by: Christian Franke --- isisd/isis_vty_fabricd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isisd/isis_vty_fabricd.c b/isisd/isis_vty_fabricd.c index 2476bd2552..431ad9712a 100644 --- a/isisd/isis_vty_fabricd.c +++ b/isisd/isis_vty_fabricd.c @@ -168,7 +168,7 @@ DEFUN (show_lsp_flooding, area->area_tag : "null"); if (lspid) { - struct isis_lsp *lsp = lsp_for_arg(head, lspid); + lsp = lsp_for_arg(head, lspid); if (lsp) lsp_print_flooding(vty, lsp); From 5627d3fec22062eea359345d2605bbb421bf5c0f Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Wed, 29 May 2019 14:44:07 +0200 Subject: [PATCH 2/2] isisd: Remove unnecessary use of strcpy `strcpy` is a dangerous function and should not be used. In this particular place, there is no need for copying strings at all, so let's just stick to referencing static strings. Signed-off-by: Christian Franke --- isisd/isisd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/isisd/isisd.c b/isisd/isisd.c index 0b7d44ea1c..bee3b6deb5 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -738,11 +738,7 @@ DEFUN (clear_isis_neighbor_arg, */ void print_debug(struct vty *vty, int flags, int onoff) { - char onoffs[4]; - if (onoff) - strcpy(onoffs, "on"); - else - strcpy(onoffs, "off"); + const char *onoffs = onoff ? "on" : "off"; if (flags & DEBUG_ADJ_PACKETS) vty_out(vty,