From: Mathieu Desnoyers Date: Thu, 18 Dec 2014 01:45:16 +0000 (-0500) Subject: Missing error handling: consumerd parse_args should return errors to caller X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8f7a281b62b77af66d5f24a3aade40bcd021d3ec;p=lttng-tools.git Missing error handling: consumerd parse_args should return errors to caller In preparation for having main() handle the return value. Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c index 299776aa0..ceb1da453 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.c +++ b/src/bin/lttng-consumerd/lttng-consumerd.c @@ -186,9 +186,9 @@ static void usage(FILE *fp) /* * daemon argument parsing */ -static void parse_args(int argc, char **argv) +static int parse_args(int argc, char **argv) { - int c; + int c, ret = 0; static struct option long_options[] = { { "consumerd-cmd-sock", 1, 0, 'c' }, @@ -218,6 +218,8 @@ static void parse_args(int argc, char **argv) fprintf(stderr, "option %s", long_options[option_index].name); if (optarg) { fprintf(stderr, " with arg %s\n", optarg); + ret = -1; + goto end; } break; case 'c': @@ -260,9 +262,12 @@ static void parse_args(int argc, char **argv) #endif default: usage(stderr); - exit(EXIT_FAILURE); + ret = -1; + goto end; } } +end: + return ret; } /*