From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUMks-00010j-9z for qemu-devel@nongnu.org; Tue, 25 Aug 2015 18:31:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUMkp-0000Jk-1y for qemu-devel@nongnu.org; Tue, 25 Aug 2015 18:31:46 -0400 Received: from e19.ny.us.ibm.com ([129.33.205.209]:40051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUMko-0000Jc-VX for qemu-devel@nongnu.org; Tue, 25 Aug 2015 18:31:43 -0400 Received: from /spool/local by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 25 Aug 2015 18:31:42 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 028D3C90043 for ; Tue, 25 Aug 2015 18:22:45 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t7PMVeKL57082104 for ; Tue, 25 Aug 2015 22:31:40 GMT Received: from d01av03.pok.ibm.com (localhost [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t7PMVe8i010042 for ; Tue, 25 Aug 2015 18:31:40 -0400 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1440540624-7998-3-git-send-email-marcandre.lureau@redhat.com> References: <1440540624-7998-1-git-send-email-marcandre.lureau@redhat.com> <1440540624-7998-3-git-send-email-marcandre.lureau@redhat.com> Message-ID: <20150825222746.11069.74948@loki> Date: Tue, 25 Aug 2015 17:27:46 -0500 Subject: Re: [Qemu-devel] [PATCH v2 02/12] qga: use exit() when parsing options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org Quoting marcandre.lureau@redhat.com (2015-08-25 17:10:14) > From: Marc-Andr=C3=A9 Lureau > = > The option parsing is going to be moved to a separate function, > use exit() consistently. > = > Signed-off-by: Marc-Andr=C3=A9 Lureau > Reviewed-by: Denis V. Lunev > Reviewed-by: Eric Blake Reviewed-by: Michael Roth > --- > qga/main.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > = > diff --git a/qga/main.c b/qga/main.c > index 791982e..10bb2f7 100644 > --- a/qga/main.c > +++ b/qga/main.c > @@ -992,14 +992,14 @@ int main(int argc, char **argv) > break; > case 'V': > printf("QEMU Guest Agent %s\n", QEMU_VERSION); > - return 0; > + exit(EXIT_SUCCESS); > case 'd': > daemonize =3D 1; > break; > case 'b': { > if (is_help_option(optarg)) { > qmp_for_each_command(ga_print_cmd, NULL); > - return 0; > + exit(EXIT_SUCCESS); > } > for (j =3D 0, i =3D 0, len =3D strlen(optarg); i < len; i++)= { > if (optarg[i] =3D=3D ',') { > @@ -1027,36 +1027,36 @@ int main(int argc, char **argv) > NULL : > state_dir; > if (ga_install_vss_provider()) { > - return EXIT_FAILURE; > + exit(EXIT_FAILURE); > } > if (ga_install_service(path, log_filepath, fixed_state_d= ir)) { > - return EXIT_FAILURE; > + exit(EXIT_FAILURE); > } > - return 0; > + exit(EXIT_SUCCESS); > } else if (strcmp(service, "uninstall") =3D=3D 0) { > ga_uninstall_vss_provider(); > - return ga_uninstall_service(); > + exit(ga_uninstall_service()); > } else if (strcmp(service, "vss-install") =3D=3D 0) { > if (ga_install_vss_provider()) { > - return EXIT_FAILURE; > + exit(EXIT_FAILURE); > } > - return EXIT_SUCCESS; > + exit(EXIT_SUCCESS); > } else if (strcmp(service, "vss-uninstall") =3D=3D 0) { > ga_uninstall_vss_provider(); > - return EXIT_SUCCESS; > + exit(EXIT_SUCCESS); > } else { > printf("Unknown service command.\n"); > - return EXIT_FAILURE; > + exit(EXIT_FAILURE); > } > break; > #endif > case 'h': > usage(argv[0]); > - return 0; > + exit(EXIT_SUCCESS); > case '?': > g_print("Unknown option, try '%s --help' for more informatio= n.\n", > argv[0]); > - return EXIT_FAILURE; > + exit(EXIT_FAILURE); > } > } > = > -- = > 2.4.3 >=20