From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 2/9] xl: Improve return and exit codes of restore and save related functions. Date: Wed, 2 Mar 2016 19:02:19 +0100 Message-ID: <1456941739.2959.396.camel@citrix.com> References: <1456318407-3635-1-git-send-email-write.harmandeep@gmail.com> <1456318407-3635-3-git-send-email-write.harmandeep@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4170288046348518049==" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1abB6V-0001Pq-KX for xen-devel@lists.xenproject.org; Wed, 02 Mar 2016 18:02:31 +0000 In-Reply-To: <1456318407-3635-3-git-send-email-write.harmandeep@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Harmandeep Kaur , xen-devel@lists.xenproject.org Cc: wei.liu2@citrix.com, ian.jackson@eu.citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org --===============4170288046348518049== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-rOkLm8dHPWUpjTixmepC" --=-rOkLm8dHPWUpjTixmepC Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2016-02-24 at 18:23 +0530, Harmandeep Kaur wrote: > Signed-off-by: Harmandeep Kaur > --- > =C2=A0tools/libxl/xl_cmdimpl.c | 40 ++++++++++++++++++++---------------- > ---- > =C2=A01 file changed, 20 insertions(+), 20 deletions(-) >=20 > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index 8f5a2f4..e5bb41f 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -2708,11 +2708,11 @@ static uint32_t create_domain(struct > domain_create *dom_info) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0restore_fd =3D open(restore_file, O_RDONLY); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0if (restore_fd =3D=3D -1) { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0fprintf(stderr, "Can't open restore file: %s\= n", > strerror(errno)); > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0return ERROR_INVAL; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0return -1; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0} Ah, so here it is create_domain(). Mmm... no, I think it would be best to have it changed in the other patch where I mentioned it, together with the other domain creation related functions. That being said, the way in which the function is changed looks ok to me. Only one comment about this hunk: > @@ -3091,9 +3091,9 @@ out: > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* already happened in the parent. > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0*/ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ( daemonize && !need_daemon ) > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0exit(ret); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0exit(EXIT_SUCCESS); > =C2=A0 > -=C2=A0=C2=A0=C2=A0=C2=A0return ret; > +=C2=A0=C2=A0=C2=A0=C2=A0return ret < 0 ? -1 : 0; > The ret<0 part was thre because libxl error codes where used... now that we're not using them any longer, can we just initialize ret to 0, change it to -1 on error (like you're doing) and, here, just return it. Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-rOkLm8dHPWUpjTixmepC 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 iEYEABECAAYFAlbXKqwACgkQk4XaBE3IOsQCAgCgoitcYDpqdTDuojbvpwa9G4HO z/EAn1chhVSX/DKVmq49VzScBfYPNxME =vsEH -----END PGP SIGNATURE----- --=-rOkLm8dHPWUpjTixmepC-- --===============4170288046348518049== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --===============4170288046348518049==--