[lttng-dev] [PATCH lttng-tools 04/13] Missing error handling: ust_app_ht_alloc should return error status

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Dec 17 20:45:15 EST 2014


In preparation for having sessiond main() handle the error.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 src/bin/lttng-sessiond/ust-app.c | 12 +++++++++++-
 src/bin/lttng-sessiond/ust-app.h |  2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index 3abd127..9ab5f77 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -3438,11 +3438,21 @@ void ust_app_clean_list(void)
 /*
  * Init UST app hash table.
  */
-void ust_app_ht_alloc(void)
+int ust_app_ht_alloc(void)
 {
 	ust_app_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
+	if (!ust_app_ht) {
+		return -1;
+	}
 	ust_app_ht_by_sock = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
+	if (!ust_app_ht_by_sock) {
+		return -1;
+	}
 	ust_app_ht_by_notify_sock = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
+	if (!ust_app_ht_by_notify_sock) {
+		return -1;
+	}
+	return 0;
 }
 
 /*
diff --git a/src/bin/lttng-sessiond/ust-app.h b/src/bin/lttng-sessiond/ust-app.h
index d1e260f..2d3695c 100644
--- a/src/bin/lttng-sessiond/ust-app.h
+++ b/src/bin/lttng-sessiond/ust-app.h
@@ -313,7 +313,7 @@ int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
 void ust_app_global_update(struct ltt_ust_session *usess, int sock);
 
 void ust_app_clean_list(void);
-void ust_app_ht_alloc(void);
+int ust_app_ht_alloc(void);
 struct ust_app *ust_app_find_by_pid(pid_t pid);
 int ust_app_calibrate_glb(struct lttng_ust_calibrate *calibrate);
 struct ust_app_stream *ust_app_alloc_stream(void);
-- 
2.1.1




More information about the lttng-dev mailing list