From a8b29026bc93afd77495e24e01b9dc7728318e76 Mon Sep 17 00:00:00 2001 From: Tyler Stroh Date: Thu, 18 Aug 2016 10:29:48 -0700 Subject: [PATCH] TS-2153 : Add -M to traffic_manager options if needed --- mgmt/LocalManager.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc index 8ab3775be1b..520e222cb81 100644 --- a/mgmt/LocalManager.cc +++ b/mgmt/LocalManager.cc @@ -37,6 +37,8 @@ #include #endif +#define MGMT_OPT "-M" + void LocalManager::mgmtCleanup() { @@ -900,6 +902,11 @@ LocalManager::startProxy() real_proxy_options.append(proxy_options, strlen(proxy_options)); + if (!strstr(proxy_options, MGMT_OPT)) { // Make sure we're starting the proxy in mgmt mode + real_proxy_options.append(" ", strlen(" ")); + real_proxy_options.append(MGMT_OPT, sizeof(MGMT_OPT) - 1); + } + // Check if we need to pass down port/fd information to // traffic_server by seeing if there are any open ports. for (int i = 0, limit = m_proxy_ports.length(); !open_ports_p && i < limit; ++i) { @@ -940,10 +947,6 @@ LocalManager::startProxy() options[i++] = tok; } - if (!strstr(proxy_options, "-M")) { // Make sure we're starting the proxy in mgmt mode - mgmt_fatal(stderr, 0, "[LocalManager::startProxy] ts options must contain -M"); - } - EnableDeathSignal(SIGTERM); execv(absolute_proxy_binary, options);