Github user jpeach commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/1073#discussion_r83994912
  
    --- Diff: cmd/traffic_manager/traffic_manager.cc ---
    @@ -610,32 +616,37 @@ main(int argc, const char **argv)
       RecLocalStart(configFiles);
     
       /* Update cmd line overrides/environmental overrides/etc */
    -  if (tsArgs) { /* Passed command line args for proxy */
    -    ats_free(lmgmt->proxy_options);
    -    lmgmt->proxy_options = tsArgs;
    -    mgmt_log("[main] Traffic Server Args: '%s'\n", lmgmt->proxy_options);
    -  }
    +  if (tsArgs)  /* Passed command line args for proxy */
    +    callback_proxy_options.push_back(ats_strdup(tsArgs));
     
    -  // we must pass in bind_stdout and bind_stderr values to TS
    -  // we do it so TS is able to create BaseLogFiles for each value
    +  // we must give bind_stdout and bind_stderr values to 
callback_proxy_options
    +  // so LocalManager can start up TS with the correct options
    +  //
    +  // TS needs them to be able to create BaseLogFiles for each value
       if (*bind_stdout != 0) {
    -    size_t l = strlen(lmgmt->proxy_options);
    -    size_t n = 3                            /* " --" */
    -               + sizeof(TM_OPT_BIND_STDOUT) /* nul accounted for here */
    -               + 1                          /* space */
    -               + strlen(bind_stdout);
    -    lmgmt->proxy_options = static_cast<char 
*>(ats_realloc(lmgmt->proxy_options, n + l));
    -    snprintf(lmgmt->proxy_options + l, n, " --%s %s", TM_OPT_BIND_STDOUT, 
bind_stdout);
    +    char *bind_stdout_opt = new char[strlen("--") + 
strlen(TM_OPT_BIND_STDOUT)];
    +    strcpy(bind_stdout_opt, "--");
    +    strcat(bind_stdout_opt, TM_OPT_BIND_STDOUT);
    +    callback_proxy_options.push_back(bind_stdout_opt);
    +    callback_proxy_options.push_back(ats_strdup(bind_stdout));
       }
     
       if (*bind_stderr != 0) {
    -    size_t l = strlen(lmgmt->proxy_options);
    -    size_t n = 3                            /* space dash dash */
    -               + sizeof(TM_OPT_BIND_STDERR) /* nul accounted for here */
    -               + 1                          /* space */
    -               + strlen(bind_stderr);
    -    lmgmt->proxy_options = static_cast<char 
*>(ats_realloc(lmgmt->proxy_options, n + l));
    -    snprintf(lmgmt->proxy_options + l, n, " --%s %s", TM_OPT_BIND_STDERR, 
bind_stderr);
    +    char *bind_stderr_opt = new char[strlen("--") + 
strlen(TM_OPT_BIND_STDERR)];
    +    strcpy(bind_stderr_opt, "--");
    +    strcat(bind_stderr_opt, TM_OPT_BIND_STDERR);
    --- End diff --
    
    ```C
    foo.push_back("--" TM_OPT_BIND_STDERR")


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to