diff mbox

iproute: print more verbose error on route cache flush

Message ID 1441438850-4793-1-git-send-email-kda@linux-powerpc.org
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Denis Kirjanov Sept. 5, 2015, 7:40 a.m. UTC
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 <kda@linux-powerpc.org>
---
 ip/iproute.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stephen Hemminger Sept. 7, 2015, 6:10 p.m. UTC | #1
On Sat,  5 Sep 2015 10:40:50 +0300
Denis Kirjanov <kda@linux-powerpc.org> 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 denied
> 
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
> ---
>  ip/iproute.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ip/iproute.c b/ip/iproute.c
> index 8f49e62..abe4180 100644
> --- a/ip/iproute.c
> +++ b/ip/iproute.c
> @@ -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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/ip/iproute.c b/ip/iproute.c
index 8f49e62..abe4180 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -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;
 	}