ctrl: Add check for result rtnl_dump_filter()
Subsystems (2)
PATCH 1/1 ctrl: Add check for result rtnl_dump_filter()
Added check for result of rtnl_dump_filter() function for catch errors linked with dump.
Found by RASU JSC.
Signed-off-by Maks Mishin <[email protected]>
--- genl/ctrl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
genl/ctrl.c +4 -1
@@ -313,7 +313,10 @@ static int ctrl_list(int cmd, int argc, char **argv) goto ctrl_done; } -rtnl_dump_filter (&rth, print_ctrl2, stdout); +if (rtnl_dump_filter (&rth, print_ctrl2, stdout) <0 ) { +fprintf (stderr,"Dump terminated\n" ); +exit (1 ); + } }
Signature · 1 line
2.30.2
Quoted 14 lines · On Sun, 18 Feb 2024 22:43:09 +0300 Maks Mishin <[email protected]> wrote:
Added check for result of
rtnl_dump_filter()function for catch errors linked with dump.
Found by RASU JSC.Signed-off-by Maks Mishin <[email protected]>--- genl/ctrl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)genl/ctrl.c +0
-0
genl/ctrl.c static int ctrl_list(int cmd, int argc, char **argv) · line 318
Quoted 7 lines
genl/ctrl.c +3
-1@@ -313,7 +313,10 @@ static int ctrl_list(int cmd, int argc, char **argv) goto ctrl_done; } -rtnl_dump_filter (&rth, print_ctrl2, stdout); +if (rtnl_dump_filter (&rth, print_ctrl2, stdout) <0 ) { +fprintf (stderr,"Dump terminated\n" ); +exit (1 );
Why does this have to be fatal and call exit()?
Other places in same code just return error.