From: Simon Marchi Date: Wed, 14 Aug 2019 17:49:51 +0000 (-0400) Subject: cli: return if bt_plugin_find_all_from_dir fails in load_dynamic_plugins X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=70dfe5e41a18dc2225d1b80dccd547050ee5df35 cli: return if bt_plugin_find_all_from_dir fails in load_dynamic_plugins If the call to bt_plugin_find_all_from_dir in load_dynamic_plugins returns an error (a negative status code), we currently continue execution as if nothing happened. This patch makes it so that we exit the loop and report the error to the caller. Change-Id: Ib22813b92fe06156cde1681c55651a294cd67909 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/1934 Tested-by: jenkins Reviewed-by: Philippe Proulx --- diff --git a/src/cli/babeltrace2-plugins.c b/src/cli/babeltrace2-plugins.c index 1defc306..28ee50a5 100644 --- a/src/cli/babeltrace2-plugins.c +++ b/src/cli/babeltrace2-plugins.c @@ -163,9 +163,11 @@ int load_dynamic_plugins(const bt_value *plugin_paths) status = bt_plugin_find_all_from_dir(plugin_path, BT_FALSE, BT_FALSE, &plugin_set); if (status < 0) { - BT_LOGE("Unable to load dynamic plugins from directory: " + BT_CLI_LOGE_APPEND_CAUSE( + "Unable to load dynamic plugins from directory: " "path=\"%s\"", plugin_path); - continue; + ret = status; + goto end; } else if (status == BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_NOT_FOUND) { BT_LOGI("No plugins found in directory: path=\"%s\"",