iproute: print more verbose error on route cache flush
Subsystems (2)
PATCH 1/1 iproute: print more verbose error on route cache flush
Before:
kda@vfirst ~/devel/iproute2 $ ./ip/ip route flush cache Cannot open "/proc/sys/net/ipv4/route/flush"
After:
kda@vfirst ~/devel/iproute2/ip $ ./ip route flush cache Cannot open "/proc/sys/net/ipv4/route/flush": Permission denied
Signed-off-by Denis Kirjanov <[email protected]>
--- ip/iproute.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ip/iproute.c +2 -1
@@ -1213,7 +1213,8 @@ static int iproute_flush_cache(void)char *buffer ="-1" ;if (flush_fd <0 ) { -fprintf (stderr,"Cannot open \"%s\"\n" ,ROUTE_FLUSH_PATH ); +fprintf (stderr,"Cannot open \"%s\": %s\n" , +ROUTE_FLUSH_PATH ,strerror (errno));return -1 ; }
Signature · 1 line
2.4.0
Quoted 18 lines · On Sat, 5 Sep 2015 10:40:50 +0300 Denis Kirjanov <[email protected]> wrote:
Before:
kda@vfirst ~/devel/iproute2 $ ./ip/ip route flush cache Cannot open "/proc/sys/net/ipv4/route/flush"After:
kda@vfirst ~/devel/iproute2/ip $ ./ip route flush cache Cannot open "/proc/sys/net/ipv4/route/flush": Permission deniedSigned-off-by Denis Kirjanov <[email protected]>--- ip/iproute.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)ip/iproute.c +0
-0
ip/iproute.c static int iproute_flush_cache(void) · line 1220
Quoted 9 lines
ip/iproute.c +2
-1@@ -1213,7 +1213,8 @@ static int iproute_flush_cache(void)char *buffer ="-1" ;if (flush_fd <0 ) { -fprintf (stderr,"Cannot open \"%s\"\n" ,ROUTE_FLUSH_PATH ); +fprintf (stderr,"Cannot open \"%s\": %s\n" , +ROUTE_FLUSH_PATH ,strerror (errno));return -1 ; }
Sure why not, applied