[lttng-dev] [lttng-tools PATCH v2 4/4] Add error handling to setup_consumerd_path()

Alexandre Montplaisir alexandre.montplaisir at gmail.com
Mon Dec 5 13:29:32 EST 2011


Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir at gmail.com>
---
 lttng-sessiond/main.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c
index baaba58..032fb00 100644
--- a/lttng-sessiond/main.c
+++ b/lttng-sessiond/main.c
@@ -181,7 +181,7 @@ static const char *consumerd64_libdir =
 	__stringify(CONFIG_CONSUMERD64_LIBDIR);
 
 static
-void setup_consumerd_path(void)
+int setup_consumerd_path(void)
 {
 	const char *path, *libdir;
 	int ret;
@@ -233,6 +233,7 @@ void setup_consumerd_path(void)
 		consumerd32_libdir = strdup(libdir);
 		if (consumerd32_libdir == NULL) {
 			PERROR("strdup consumerd32_libdir");
+			ret = -1;
 			goto error;
 		}
 	}
@@ -241,12 +242,15 @@ void setup_consumerd_path(void)
 		consumerd64_libdir = strdup(libdir);
 		if (consumerd64_libdir == NULL) {
 			PERROR("strdup consumerd64_libdir");
+			ret = -1;
 			goto error;
 		}
 	}
 
+	return 0;
+
 error:
-	return;
+	return ret;
 }
 
 /*
@@ -4211,7 +4215,10 @@ int main(int argc, char **argv)
 		goto error;
 	}
 
-	setup_consumerd_path();
+	/* Setup the paths for the consumer daemon and libraries */
+	if ((ret = setup_consumerd_path()) < 0) {
+		goto error;
+	}
 
 	/* Parse arguments */
 	progname = argv[0];
-- 
1.7.7.3




More information about the lttng-dev mailing list