diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-08-23 22:05:33 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-08-23 22:05:33 +0000 |
commit | a3c8481a3323a5e4aa3be92bb6dc60adb30d673e (patch) | |
tree | 44fae17c8076dda7f98c4ae736dab46d79875adf | |
parent | b76cb68979e072a020a0c203bcd4ed2d2ec7afa8 (diff) | |
download | busybox-w32-a3c8481a3323a5e4aa3be92bb6dc60adb30d673e.tar.gz busybox-w32-a3c8481a3323a5e4aa3be92bb6dc60adb30d673e.tar.bz2 busybox-w32-a3c8481a3323a5e4aa3be92bb6dc60adb30d673e.zip |
A patch from Jaspreet Singh <jsingh@somanetworks.com>
fixing both a segfault and cosmetic bug in route
-rw-r--r-- | networking/route.c | 11 | ||||
-rw-r--r-- | route.c | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/networking/route.c b/networking/route.c index d571fc5a3..8e12a3f2e 100644 --- a/networking/route.c +++ b/networking/route.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * Foundation; either version 2 of the License, or (at | 15 | * Foundation; either version 2 of the License, or (at |
16 | * your option) any later version. | 16 | * your option) any later version. |
17 | * | 17 | * |
18 | * $Id: route.c,v 1.10 2001/03/21 07:34:26 andersen Exp $ | 18 | * $Id: route.c,v 1.11 2001/08/23 22:05:33 andersen Exp $ |
19 | * | 19 | * |
20 | * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> | 20 | * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> |
21 | * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> | 21 | * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> |
@@ -108,6 +108,8 @@ INET_setroute(int action, int options, char **args) | |||
108 | 108 | ||
109 | xflag = 0; | 109 | xflag = 0; |
110 | 110 | ||
111 | if (*args == NULL) | ||
112 | show_usage(); | ||
111 | if (strcmp(*args, "-net")==0) { | 113 | if (strcmp(*args, "-net")==0) { |
112 | xflag = 1; | 114 | xflag = 1; |
113 | args++; | 115 | args++; |
@@ -115,9 +117,6 @@ INET_setroute(int action, int options, char **args) | |||
115 | xflag = 2; | 117 | xflag = 2; |
116 | args++; | 118 | args++; |
117 | } | 119 | } |
118 | if (*args == NULL) | ||
119 | show_usage(); | ||
120 | |||
121 | safe_strncpy(target, *args++, (sizeof target)); | 120 | safe_strncpy(target, *args++, (sizeof target)); |
122 | 121 | ||
123 | /* Clean out the RTREQ structure. */ | 122 | /* Clean out the RTREQ structure. */ |
@@ -375,9 +374,11 @@ static void displayroutes(void) | |||
375 | if(nl==1) { | 374 | if(nl==1) { |
376 | printf("Kernel IP routing table\n" | 375 | printf("Kernel IP routing table\n" |
377 | "Destination Gateway Genmask Flags Metric Ref Use Iface\n"); | 376 | "Destination Gateway Genmask Flags Metric Ref Use Iface\n"); |
377 | } else { | ||
378 | nl++; | ||
379 | continue; | ||
378 | } | 380 | } |
379 | 381 | ||
380 | |||
381 | ifl = 0; /* parse flags */ | 382 | ifl = 0; /* parse flags */ |
382 | if(flgs&1) | 383 | if(flgs&1) |
383 | flags[ifl++]='U'; | 384 | flags[ifl++]='U'; |
@@ -15,7 +15,7 @@ | |||
15 | * Foundation; either version 2 of the License, or (at | 15 | * Foundation; either version 2 of the License, or (at |
16 | * your option) any later version. | 16 | * your option) any later version. |
17 | * | 17 | * |
18 | * $Id: route.c,v 1.10 2001/03/21 07:34:26 andersen Exp $ | 18 | * $Id: route.c,v 1.11 2001/08/23 22:05:33 andersen Exp $ |
19 | * | 19 | * |
20 | * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> | 20 | * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> |
21 | * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> | 21 | * adjustments by Larry Doolittle <LRDoolittle@lbl.gov> |
@@ -108,6 +108,8 @@ INET_setroute(int action, int options, char **args) | |||
108 | 108 | ||
109 | xflag = 0; | 109 | xflag = 0; |
110 | 110 | ||
111 | if (*args == NULL) | ||
112 | show_usage(); | ||
111 | if (strcmp(*args, "-net")==0) { | 113 | if (strcmp(*args, "-net")==0) { |
112 | xflag = 1; | 114 | xflag = 1; |
113 | args++; | 115 | args++; |
@@ -115,9 +117,6 @@ INET_setroute(int action, int options, char **args) | |||
115 | xflag = 2; | 117 | xflag = 2; |
116 | args++; | 118 | args++; |
117 | } | 119 | } |
118 | if (*args == NULL) | ||
119 | show_usage(); | ||
120 | |||
121 | safe_strncpy(target, *args++, (sizeof target)); | 120 | safe_strncpy(target, *args++, (sizeof target)); |
122 | 121 | ||
123 | /* Clean out the RTREQ structure. */ | 122 | /* Clean out the RTREQ structure. */ |
@@ -375,9 +374,11 @@ static void displayroutes(void) | |||
375 | if(nl==1) { | 374 | if(nl==1) { |
376 | printf("Kernel IP routing table\n" | 375 | printf("Kernel IP routing table\n" |
377 | "Destination Gateway Genmask Flags Metric Ref Use Iface\n"); | 376 | "Destination Gateway Genmask Flags Metric Ref Use Iface\n"); |
377 | } else { | ||
378 | nl++; | ||
379 | continue; | ||
378 | } | 380 | } |
379 | 381 | ||
380 | |||
381 | ifl = 0; /* parse flags */ | 382 | ifl = 0; /* parse flags */ |
382 | if(flgs&1) | 383 | if(flgs&1) |
383 | flags[ifl++]='U'; | 384 | flags[ifl++]='U'; |