From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v2 07/10] xl_cmdimpl - Add return codes for pci-detach, pci-attach, pci-asssignable-add, and pci-assignable-remove. Date: Fri, 8 Apr 2016 10:36:56 +0200 Message-ID: <1460104616.13871.38.camel@citrix.com> References: <1459943163-18697-1-git-send-email-paulinaszubarczyk@gmail.com> <1459943163-18697-8-git-send-email-paulinaszubarczyk@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1166862014892827178==" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoRuc-000528-I4 for xen-devel@lists.xenproject.org; Fri, 08 Apr 2016 08:37:06 +0000 In-Reply-To: <1459943163-18697-8-git-send-email-paulinaszubarczyk@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Paulina Szubarczyk , xen-devel@lists.xenproject.org, roger.pau@citrix.com, George.Dunlap@eu.citrix.com Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org --===============1166862014892827178== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-aW7X/wzJZr03LmfuQS3b" --=-aW7X/wzJZr03LmfuQS3b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2016-04-06 at 13:46 +0200, Paulina Szubarczyk wrote: > From: George Dunlap >=20 > Returning error codes makes it easier for shell scripts to tell if a > command has failed or succeeded. >=20 > NB this violates the CODING_STYLE preference for not initializing the > return-value variable at declaration; but in these cases, having a > "goto out" that jumped over nothing but an "r =3D 0" seemed > a bit pointless. >=20 AFAIUI, that rule applies to 'int rc' variables, meant at hosting libxl error codes and not equally strictly (although it might be a nice to have) to 'int r' and alike variables meant at hosting return code from interna functions, syscalls, libxc calls, etc. Unless I'm missing or misreading something from libxl's CODING_STYLE. :-) > Signed-off-by: George Dunlap > Signed-off-by: Paulina Szubarczyk >=20 > --- > Changed since v1: > * Changed exit() calls to 'return 1;' >=20 Why do we need to do that? changing exit() in either exit(EXIT_SUCCESS) or (in most of the cases) exit(EXIT_FAILURE) is much better, and is the patter we're (slowly :-/) trying to force into xl. Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-aW7X/wzJZr03LmfuQS3b Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEABECAAYFAlcHbakACgkQk4XaBE3IOsQOQACgnvic6YZPSZYUPg8MYt9kksc6 lLYAniN/MArsoDEa3TOhjJeDeYda28Oa =T79C -----END PGP SIGNATURE----- --=-aW7X/wzJZr03LmfuQS3b-- --===============1166862014892827178== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --===============1166862014892827178==--