Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unreachable clause where both tmp_plugin and tmp_plugin_instance are non-empty. #3350

Merged
merged 2 commits into from Jan 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/aggregation.c
Expand Up @@ -194,17 +194,21 @@ static int agg_instance_create_name(agg_instance_t *inst, /* {{{ */
sstrncpy(tmp_plugin_instance, agg->ident.plugin_instance,
sizeof(tmp_plugin_instance));

// Both tmp_plugin and tmp_plugin_instance are empty.
if ((strcmp("", tmp_plugin) == 0) && (strcmp("", tmp_plugin_instance) == 0))
sstrncpy(inst->ident.plugin_instance, AGG_FUNC_PLACEHOLDER,
sizeof(inst->ident.plugin_instance));
else if (strcmp("", tmp_plugin) != 0)
// tmp_plugin is non-empty, and tmp_plugin_instance is empty.
else if (strcmp("", tmp_plugin_instance) == 0)
ssnprintf(inst->ident.plugin_instance,
sizeof(inst->ident.plugin_instance), "%s-%s", tmp_plugin,
AGG_FUNC_PLACEHOLDER);
else if (strcmp("", tmp_plugin_instance) != 0)
// tmp_plugin is empty, and tmp_plugin_instance is non-empty.
else if (strcmp("", tmp_plugin) == 0)
ssnprintf(inst->ident.plugin_instance,
sizeof(inst->ident.plugin_instance), "%s-%s",
tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
// Both tmp_plugin and tmp_plugin_instance are non-empty.
else
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This else clause is not reachable before this fix.

ssnprintf(inst->ident.plugin_instance,
sizeof(inst->ident.plugin_instance), "%s-%s-%s", tmp_plugin,
Expand Down