Missing error handling: consumerd parse_args should return errors to caller
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 18 Dec 2014 01:45:16 +0000 (20:45 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 5 Jan 2015 21:18:15 +0000 (16:18 -0500)
In preparation for having main() handle the return value.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-consumerd/lttng-consumerd.c

index 299776aa00400ea6ab806cb98a49f1a1b0e30f98..ceb1da453a915edcde988f6781aa8c41d3234de8 100644 (file)
@@ -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;
 }
 
 /*
This page took 0.027359 seconds and 4 git commands to generate.