From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com ([209.85.215.67]:37602 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750829AbeBTUR2 (ORCPT ); Tue, 20 Feb 2018 15:17:28 -0500 Received: by mail-lf0-f67.google.com with SMTP id y19so6023019lfd.4 for ; Tue, 20 Feb 2018 12:17:27 -0800 (PST) Subject: Re: [PATCH iproute2-next 1/8] iplink: Return from function instead of calling exit() To: Stephen Hemminger Cc: netdev@vger.kernel.org, dsahern@gmail.com References: <1519155598-22137-1-git-send-email-serhe.popovych@gmail.com> <1519155598-22137-2-git-send-email-serhe.popovych@gmail.com> <20180220120821.61fe7d74@xeon-e3> From: Serhey Popovych Message-ID: Date: Tue, 20 Feb 2018 22:17:24 +0200 MIME-Version: 1.0 In-Reply-To: <20180220120821.61fe7d74@xeon-e3> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yr7JbPOBgHuUrzHlwW9stuZ4z1LuqQcXE" Sender: netdev-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --yr7JbPOBgHuUrzHlwW9stuZ4z1LuqQcXE Content-Type: multipart/mixed; boundary="5kdRq39WPi7ikgo88lrOo5YNoFktRmgMB"; protected-headers="v1" From: Serhey Popovych To: Stephen Hemminger Cc: netdev@vger.kernel.org, dsahern@gmail.com Message-ID: Subject: Re: [PATCH iproute2-next 1/8] iplink: Return from function instead of calling exit() References: <1519155598-22137-1-git-send-email-serhe.popovych@gmail.com> <1519155598-22137-2-git-send-email-serhe.popovych@gmail.com> <20180220120821.61fe7d74@xeon-e3> In-Reply-To: <20180220120821.61fe7d74@xeon-e3> --5kdRq39WPi7ikgo88lrOo5YNoFktRmgMB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Stephen Hemminger wrote: > On Tue, 20 Feb 2018 21:39:51 +0200 > Serhey Popovych wrote: >=20 >> Signed-off-by: Serhey Popovych >> --- >> ip/iplink.c | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/ip/iplink.c b/ip/iplink.c >> index 74c377c..a2c8108 100644 >> --- a/ip/iplink.c >> +++ b/ip/iplink.c >> @@ -653,7 +653,7 @@ int iplink_parse(int argc, char **argv, struct ipl= ink_req *req, >> NEXT_ARG(); >> if (xdp_parse(&argc, &argv, req, dev_index, >> generic, drv, offload)) >> - exit(-1); >> + return -1; >> } else if (strcmp(*argv, "netns") =3D=3D 0) { >> NEXT_ARG(); >> if (netns !=3D -1) >> @@ -972,12 +972,12 @@ static int iplink_modify(int cmd, unsigned int f= lags, int argc, char **argv) >> if (!dev) { >> fprintf(stderr, >> "Not enough information: \"dev\" argument is required.\n"); >> - exit(-1); >> + return -1; >> } >> if (cmd =3D=3D RTM_NEWLINK && index) { >> fprintf(stderr, >> "index can be used only when creating devices.\n"); >> - exit(-1); >> + return -1; >> } >> =20 >> req.i.ifi_index =3D ll_name_to_index(dev); >> @@ -1392,7 +1392,7 @@ static int do_set(int argc, char **argv) >> if (!dev) { >> fprintf(stderr, >> "Not enough of information: \"dev\" argument is required.\n"); >> - exit(-1); >> + return -1; >> } >> =20 >> if (newaddr || newbrd) { >> @@ -1553,7 +1553,7 @@ static int iplink_afstats(int argc, char **argv)= >> fprintf(stderr, >> "Command \"%s\" is unknown, try \"ip link help\".\n", >> *argv); >> - exit(-1); >> + return -1; >> } >> =20 >> argv++; argc--; >> @@ -1648,5 +1648,5 @@ int do_iplink(int argc, char **argv) >> =20 >> fprintf(stderr, "Command \"%s\" is unknown, try \"ip link help\".\n"= , >> *argv); >> - exit(-1); >> + return -1; >> } >=20 > Not sure I like this. If given bad input in batch it is better to stop = and exit > rather than continuing with more bad data. When preparing this change I think in opposite direction: we want to continue batch mode if single line is broken. If desired I will drop this one. >=20 --5kdRq39WPi7ikgo88lrOo5YNoFktRmgMB-- --yr7JbPOBgHuUrzHlwW9stuZ4z1LuqQcXE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJajIJUAAoJEBTawMmQ61bB46gH/3YGpddgAd14RQxjBkG2XgRW gkavnLUctmv4Mw5zsTGTbAyA1zVUFk6D94TcpegoTrSXuze+kdNBsJuHutKacJJ0 gGHelVpdY4qZYZwpZLgXMRqBeydmshNsCkGph1zYSkQ3rVXQByg88C1+BrFoSKAX +XKzzS16G0yUvbSOylXHBGUkzHdWLFAWC9fXETEc8qYUJFxfZZO/pdvWWpwGyAnQ FcVmDw0xefyPecyK5xlwmb5B/KnbJ41XXUujtyaxPJY/DC6bZnGhwrG9rV1QOxnB GAGqvdGXoispboH/X5A0vUDJiy0Cl/5AJ0UvUcp1lsl/7MksskWCZYyGbdpiGiM= =82fJ -----END PGP SIGNATURE----- --yr7JbPOBgHuUrzHlwW9stuZ4z1LuqQcXE--