From: Eric Andersen Date: Thu, 23 Aug 2001 19:10:52 +0000 (-0000) Subject: A patch from Jaspreet Singh to fix a segfault and display nothing wher X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=170e4a7395202eafa6da61266b36fc08637c8f09;p=oweals%2Fbusybox.git A patch from Jaspreet Singh to fix a segfault and display nothing wher there is nothing to display. --- diff --git a/busybox/networking/route.c b/busybox/networking/route.c index d571fc5a3..21cbb3a17 100644 --- a/busybox/networking/route.c +++ b/busybox/networking/route.c @@ -15,7 +15,7 @@ * Foundation; either version 2 of the License, or (at * your option) any later version. * - * $Id: route.c,v 1.10 2001/03/21 07:34:26 andersen Exp $ + * $Id: route.c,v 1.10.2.1 2001/08/23 19:10:52 andersen Exp $ * * displayroute() code added by Vladimir N. Oleynik * adjustments by Larry Doolittle @@ -108,6 +108,8 @@ INET_setroute(int action, int options, char **args) xflag = 0; + if (*args == NULL) + show_usage(); if (strcmp(*args, "-net")==0) { xflag = 1; args++; @@ -375,9 +377,11 @@ static void displayroutes(void) if(nl==1) { printf("Kernel IP routing table\n" "Destination Gateway Genmask Flags Metric Ref Use Iface\n"); + } else { + nl++; + continue; } - ifl = 0; /* parse flags */ if(flgs&1) flags[ifl++]='U'; diff --git a/busybox/route.c b/busybox/route.c index d571fc5a3..21cbb3a17 100644 --- a/busybox/route.c +++ b/busybox/route.c @@ -15,7 +15,7 @@ * Foundation; either version 2 of the License, or (at * your option) any later version. * - * $Id: route.c,v 1.10 2001/03/21 07:34:26 andersen Exp $ + * $Id: route.c,v 1.10.2.1 2001/08/23 19:10:52 andersen Exp $ * * displayroute() code added by Vladimir N. Oleynik * adjustments by Larry Doolittle @@ -108,6 +108,8 @@ INET_setroute(int action, int options, char **args) xflag = 0; + if (*args == NULL) + show_usage(); if (strcmp(*args, "-net")==0) { xflag = 1; args++; @@ -375,9 +377,11 @@ static void displayroutes(void) if(nl==1) { printf("Kernel IP routing table\n" "Destination Gateway Genmask Flags Metric Ref Use Iface\n"); + } else { + nl++; + continue; } - ifl = 0; /* parse flags */ if(flgs&1) flags[ifl++]='U';