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

    https://github.com/apache/trafficserver/pull/1201#discussion_r86699484
  
    --- Diff: plugins/experimental/ts_lua/ts_lua.c ---
    @@ -64,18 +65,46 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, 
char *errbuf, int errbuf_s
     {
       int fn;
       int ret;
    +  int states                           = TS_LUA_MAX_STATE_COUNT;
    +  static const struct option longopt[] = {
    +    {"states", required_argument, 0, 's'}, {0, 0, 0, 0},
    +  };
    +
    +  argc--;
    +  argv++;
    +
    +  for (;;) {
    +    int opt;
    +
    +    opt = getopt_long(argc, (char *const *)argv, "", longopt, NULL);
    +    switch (opt) {
    +    case 's':
    +      states = atoi(optarg);
    +      // set state
    +      break;
    +    }
     
    -  if (argc < 3) {
    +    if (opt == -1) {
    +      break;
    +    }
    +  }
    +
    +  if (states > TS_LUA_MAX_STATE_COUNT || states < 1) {
    +    snprintf(errbuf, errbuf_size, "[TSRemapNewInstance] - invalid state in 
option input");
    --- End diff --
    
    Include the max and given values?


---
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