From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 107045A0082 for ; Thu, 16 Feb 2023 06:43:26 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4PHP4K6h8Lz4x8G; Thu, 16 Feb 2023 16:43:13 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1676526193; bh=usER3kZaQWmCSwWawnkCDQ6lcZji8tbb+MISnHdP6T4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mrR9Q2ry/Pi9yO7HvD3Qc7LJ44rvIBbA2r8z6zvrBAkigPeg4iuKiTMe4goLnVpoI Ztb0kh5x3mzuQctWLoaKpG97ptHFUGNFHfyrkIivor4hhS14aisbbdffCUKmfUbBY9 Z1DxMQnwYxBa5dNqFxucYShKhIWgNL8s68Dc5Gow= Date: Thu, 16 Feb 2023 16:38:41 +1100 From: David Gibson To: Laine Stump Subject: Re: [PATCH v4 7/9] make conf_netns_opt() exit immediately after logging error Message-ID: References: <20230215082437.110151-1-laine@redhat.com> <20230215082437.110151-8-laine@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hzYd5JZgDF3hSIFD" Content-Disposition: inline In-Reply-To: <20230215082437.110151-8-laine@redhat.com> Message-ID-Hash: PUQ7DP5OIJW6TSDUEABGHY7TFJTS6V5P X-Message-ID-Hash: PUQ7DP5OIJW6TSDUEABGHY7TFJTS6V5P X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --hzYd5JZgDF3hSIFD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 15, 2023 at 03:24:35AM -0500, Laine Stump wrote: > ...and return void to simplify the caller. >=20 > Signed-off-by: Laine Stump Reviewed-by: David Gibson > --- > conf.c | 16 ++++------------ > 1 file changed, 4 insertions(+), 12 deletions(-) >=20 > diff --git a/conf.c b/conf.c > index 19020f9..d020b4f 100644 > --- a/conf.c > +++ b/conf.c > @@ -464,10 +464,8 @@ out: > * conf_netns_opt() - Parse --netns option > * @netns: buffer of size PATH_MAX, updated with netns path > * @arg: --netns argument > - * > - * Return: 0 on success, negative error code otherwise > */ > -static int conf_netns_opt(char *netns, const char *arg) > +static void conf_netns_opt(char *netns, const char *arg) > { > int ret; > =20 > @@ -479,12 +477,8 @@ static int conf_netns_opt(char *netns, const char *a= rg) > ret =3D snprintf(netns, PATH_MAX, "%s", arg); > } > =20 > - if (ret <=3D 0 || ret > PATH_MAX) { > - err("Network namespace name/path %s too long"); > - return -E2BIG; > - } > - > - return 0; > + if (ret <=3D 0 || ret > PATH_MAX) > + die("Network namespace name/path %s too long"); > } > =20 > /** > @@ -1157,9 +1151,7 @@ void conf(struct ctx *c, int argc, char **argv) > if (c->mode !=3D MODE_PASTA) > die("--netns is for pasta mode only"); > =20 > - ret =3D conf_netns_opt(netns, optarg); > - if (ret < 0) > - usage(argv[0]); > + conf_netns_opt(netns, optarg); > break; > case 4: > if (c->mode !=3D MODE_PASTA) --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --hzYd5JZgDF3hSIFD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmPtwVsACgkQzQJF27ox 2GefdA/+I+C/I+pckMRBU8GL9RFORDLkEGROcYOoPIiOaOLe/r+tdngwS5+cX2Fq j0ZkL9e5N4bTCOGOmWz9i33tR6OozFklEPQfhyUNhnCO+5fGro+0KpodjW5rHqkm MN1IyVsSiPdDuuGb4BeumUI+mFpx9yaSyCx/89nLwMsGnxjm0WQFsBcJjn7w3h8B E+RC9AYJqH9WquTivnjy8Kmym2A4gLeQd6NWMEvpG2CGT/FfXCubM0d8Z6sLM5ou odROG3KAwD00Y5XilealHr4fd0NOeKrv1zw8ODszMWvPuiqJ2RQSgGusuG5Y6yI0 Oktcq12SbwZl9p5OaEKwHyGN8XQq0tVY18xSAoUSMmN+w6q9xjiTH+g8EtphCPPp 1/+x8dQF8SsiUkY58H/LY4NLvJVu/I2iUfUzfdNnegBnvaE2oEmB4I4BekwmE2DH Zp0ua2ZODHlhiTaL0ncyYkse7/J9pWl22wJ8xwJpsDO14jLdr0P6IP/dcazQH949 6JdpDmz9T4+aIRQUIe0Wv9Q/nNl5fylOxdsa836b+ttKNhn50jO+LYOIROpFRTcx xo1M+7SXaW8lB6tEjJ+yl0JfOzPIhD9b2VyQuUXHZFcV00dWd/WG5fTNC+e8lJro GUJtL4cD/UE37DtvHuib4YKSqhuyUcs3oCK8bTGpM4OcNvu3PIA= =KEV+ -----END PGP SIGNATURE----- --hzYd5JZgDF3hSIFD--