MCPcopy Create free account
hub / github.com/apache/trafficserver / verify_plugin_helper

Function verify_plugin_helper

src/traffic_server/traffic_server.cc:1086–1112  ·  view source on GitHub ↗

A helper for the verify plugin command functions. * * @param[in] args The arguments passed to the -C command option. This includes * verify_global_plugin. * * @param[in] symbols The expected symbols to verify exist in the plugin file. * * @return a CMD status code. See the CMD_ defines above in this file. */

Source from the content-addressed store, hash-verified

1084 * @return a CMD status code. See the CMD_ defines above in this file.
1085 */
1086int
1087verify_plugin_helper(char *args, plugin_type_t plugin_type)
1088{
1089 const auto *plugin_filename = skip(args);
1090 if (!plugin_filename) {
1091 fprintf(stderr, "ERROR: verifying a plugin requires a plugin SO file path argument\n");
1092 return CMD_FAILED;
1093 }
1094
1095 fs::path plugin_path(plugin_filename);
1096 fprintf(stderr, "NOTE: verifying plugin '%s'...\n", plugin_filename);
1097
1098 if (!fs::exists(plugin_path)) {
1099 fprintf(stderr, "ERROR: verifying plugin '%s' Fail: No such file or directory\n", plugin_filename);
1100 return CMD_FAILED;
1101 }
1102
1103 auto ret = CMD_OK;
1104 std::string error;
1105 if (try_loading_plugin(plugin_type, plugin_path, error)) {
1106 fprintf(stderr, "NOTE: verifying plugin '%s' Success\n", plugin_filename);
1107 } else {
1108 fprintf(stderr, "ERROR: verifying plugin '%s' Fail: %s\n", plugin_filename, error.c_str());
1109 ret = CMD_FAILED;
1110 }
1111 return ret;
1112}
1113
1114/** Verify whether a given SO file looks like a valid global plugin.
1115 *

Callers 2

cmd_verify_global_pluginFunction · 0.85
cmd_verify_remap_pluginFunction · 0.85

Calls 4

skipFunction · 0.85
try_loading_pluginFunction · 0.85
existsFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected