netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] ip route get: change exit to return to support batch commands
@ 2015-10-15 22:23 Roopa Prabhu
  2015-10-16  2:38 ` David Ahern
  0 siblings, 1 reply; 4+ messages in thread
From: Roopa Prabhu @ 2015-10-15 22:23 UTC (permalink / raw)
  To: stephen; +Cc: netdev

From: Roopa Prabhu <roopa@cumulusnetworks.com>

replace exit with return -2 on rtnl_talk failure

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 ip/iproute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ip/iproute.c b/ip/iproute.c
index da25548..b137f55 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -1643,7 +1643,7 @@ static int iproute_get(int argc, char **argv)
 		req.r.rtm_family = AF_INET;
 
 	if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0)
-		exit(2);
+		return -2;
 
 	if (connected && !from_ok) {
 		struct rtmsg *r = NLMSG_DATA(&req.n);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2] ip route get: change exit to return to support batch commands
  2015-10-15 22:23 [PATCH iproute2] ip route get: change exit to return to support batch commands Roopa Prabhu
@ 2015-10-16  2:38 ` David Ahern
  2015-10-16  3:13   ` roopa
  0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2015-10-16  2:38 UTC (permalink / raw)
  To: Roopa Prabhu, stephen; +Cc: netdev

Hi Roopa:

On 10/15/15 4:23 PM, Roopa Prabhu wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> replace exit with return -2 on rtnl_talk failure
>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
>   ip/iproute.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ip/iproute.c b/ip/iproute.c
> index da25548..b137f55 100644
> --- a/ip/iproute.c
> +++ b/ip/iproute.c
> @@ -1643,7 +1643,7 @@ static int iproute_get(int argc, char **argv)
>   		req.r.rtm_family = AF_INET;
>
>   	if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0)
> -		exit(2);
> +		return -2;
>
>   	if (connected && !from_ok) {
>   		struct rtmsg *r = NLMSG_DATA(&req.n);
>

Why return -2 vs exit(2)? What does the change mean to a user or the 
functionality of ip?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2] ip route get: change exit to return to support batch commands
  2015-10-16  2:38 ` David Ahern
@ 2015-10-16  3:13   ` roopa
  2015-10-16  6:08     ` Vadim Kochan
  0 siblings, 1 reply; 4+ messages in thread
From: roopa @ 2015-10-16  3:13 UTC (permalink / raw)
  To: David Ahern; +Cc: stephen, netdev

On 10/15/15, 7:38 PM, David Ahern wrote:
> Hi Roopa:
>
> On 10/15/15 4:23 PM, Roopa Prabhu wrote:
>> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>>
>> replace exit with return -2 on rtnl_talk failure
>>
>> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
>> ---
>>   ip/iproute.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/ip/iproute.c b/ip/iproute.c
>> index da25548..b137f55 100644
>> --- a/ip/iproute.c
>> +++ b/ip/iproute.c
>> @@ -1643,7 +1643,7 @@ static int iproute_get(int argc, char **argv)
>>           req.r.rtm_family = AF_INET;
>>
>>       if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0)
>> -        exit(2);
>> +        return -2;
>>
>>       if (connected && !from_ok) {
>>           struct rtmsg *r = NLMSG_DATA(&req.n);
>>
>
> Why return -2 vs exit(2)? What does the change mean to a user or the functionality of ip?
Stephen has documented this someplace. I have seen it before. I now forget where. Right now i am just following
the rest of the code.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2] ip route get: change exit to return to support batch commands
  2015-10-16  3:13   ` roopa
@ 2015-10-16  6:08     ` Vadim Kochan
  0 siblings, 0 replies; 4+ messages in thread
From: Vadim Kochan @ 2015-10-16  6:08 UTC (permalink / raw)
  To: roopa; +Cc: David Ahern, stephen, netdev

On Thu, Oct 15, 2015 at 08:13:23PM -0700, roopa wrote:
> On 10/15/15, 7:38 PM, David Ahern wrote:
> > Hi Roopa:
> >
> > On 10/15/15 4:23 PM, Roopa Prabhu wrote:
> >> From: Roopa Prabhu <roopa@cumulusnetworks.com>
> >>
> >> replace exit with return -2 on rtnl_talk failure
> >>
> >> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> >> ---
> >>   ip/iproute.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/ip/iproute.c b/ip/iproute.c
> >> index da25548..b137f55 100644
> >> --- a/ip/iproute.c
> >> +++ b/ip/iproute.c
> >> @@ -1643,7 +1643,7 @@ static int iproute_get(int argc, char **argv)
> >>           req.r.rtm_family = AF_INET;
> >>
> >>       if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0)
> >> -        exit(2);
> >> +        return -2;
> >>
> >>       if (connected && !from_ok) {
> >>           struct rtmsg *r = NLMSG_DATA(&req.n);
> >>
> >
> > Why return -2 vs exit(2)? What does the change mean to a user or the functionality of ip?
> Stephen has documented this someplace. I have seen it before. I now forget where. Right now i am just following
> the rest of the code.
> --
> 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

Hi,

IMHO I think it would be good to have #define's for these return values.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-16  6:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 22:23 [PATCH iproute2] ip route get: change exit to return to support batch commands Roopa Prabhu
2015-10-16  2:38 ` David Ahern
2015-10-16  3:13   ` roopa
2015-10-16  6:08     ` Vadim Kochan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).