X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Foptions.c;h=f66b7657bc31c9b197b8449fa12902293fdf85d1;hb=219aac3b53d0827549377f1bfe22853ee52d4405;hp=008b48217eeef2f2c3a722566c3cfea1ad78d5d1;hpb=3089132cdf5b58dbdfc2daf08ec5c08eb47f8aca;p=ppp.git diff --git a/pppd/options.c b/pppd/options.c index 008b482..f66b765 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -96,6 +96,7 @@ int default_device = 1; /* Using /dev/tty or equivalent */ char devnam[MAXPATHLEN]; /* Device name */ bool nodetach = 0; /* Don't detach from controlling tty */ bool updetach = 0; /* Detach once link is up */ +bool master_detach; /* Detach when we're (only) multilink master */ int maxconnect = 0; /* Maximum connect time */ char user[MAXNAMELEN]; /* Username for PAP */ char passwd[MAXSECRETLEN]; /* Password for PAP */ @@ -210,6 +211,9 @@ option_t general_options[] = { "Detach from controlling tty once link is up", OPT_PRIOSUB | OPT_A2CLR | 1, &nodetach }, + { "master_detach", o_bool, &master_detach, + "Detach when we're multilink master but have no link", 1 }, + { "holdoff", o_int, &holdoff, "Set time in seconds before retrying connection", OPT_PRIO, &holdoff_specified }, @@ -772,10 +776,13 @@ process_option(opt, cmd, argv) if (opt->flags & OPT_STATIC) { strlcpy((char *)(opt->addr), *argv, opt->upper_limit); } else { + char **optptr = (char **)(opt->addr); sv = strdup(*argv); if (sv == NULL) novm("option argument"); - *(char **)(opt->addr) = sv; + if (*optptr) + free(*optptr); + *optptr = sv; } break; @@ -1285,9 +1292,10 @@ getword(f, word, newlinep, filename) /* * Store the resulting character for the escape sequence. */ - if (len < MAXWORDLEN-1) + if (len < MAXWORDLEN) { word[len] = value; - ++len; + ++len; + } if (!got) c = getc(f); @@ -1325,9 +1333,10 @@ getword(f, word, newlinep, filename) /* * An ordinary character: store it in the word and get another. */ - if (len < MAXWORDLEN-1) + if (len < MAXWORDLEN) { word[len] = c; - ++len; + ++len; + } c = getc(f); }