mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
fclose the /proc/net/route file handle after reading routes from it.
This commit is contained in:
6
tcpip.cc
6
tcpip.cc
@@ -3385,10 +3385,12 @@ struct sys_route *getsysroutes(int *howmany) {
|
|||||||
|
|
||||||
/* First let us try Linux-style /proc/net/route */
|
/* First let us try Linux-style /proc/net/route */
|
||||||
routefp = fopen("/proc/net/route", "r");
|
routefp = fopen("/proc/net/route", "r");
|
||||||
if (routefp)
|
if (routefp) {
|
||||||
routes = getsysroutes_proc(routefp, howmany);
|
routes = getsysroutes_proc(routefp, howmany);
|
||||||
else
|
fclose(routefp);
|
||||||
|
} else {
|
||||||
routes = getsysroutes_dnet(howmany);
|
routes = getsysroutes_dnet(howmany);
|
||||||
|
}
|
||||||
|
|
||||||
numroutes = *howmany;
|
numroutes = *howmany;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user