Revert "syslogd: cfopts(): reinit strtok() so both OPT1,OPT2 are found"

This reverts commit d758581 since it breaks unit tests by missing the
first option after ;

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2020-01-19 10:30:25 +01:00
parent d75858100c
commit d22f7168e0

View File

@ -2335,7 +2335,7 @@ static int cfopt(char **ptr, const char *opt)
*/
static void cfopts(char *ptr, struct filed *f)
{
char *opt, *origptr;
char *opt;
/* First locate any whitespace between action and option */
ptr = strpbrk(ptr, "\t ;");
@ -2346,17 +2346,11 @@ static void cfopts(char *ptr, struct filed *f)
if (*ptr != ';')
*ptr++ = 0;
origptr = ptr;
ptr = strtok(ptr, ";");
if (!ptr)
opt = strtok(ptr, ";");
if (!opt)
return;
for (;;) {
opt = strtok(ptr, ",");
if (!opt)
break;
ptr = NULL;
while (opt) {
if (cfopt(&opt, "RFC5424")) {
f->f_flags |= RFC5424;
f->f_flags &= ~RFC3164;
@ -2366,7 +2360,9 @@ static void cfopts(char *ptr, struct filed *f)
} else if (cfopt(&opt, "rotate="))
cfrot(opt, f);
else
cfrot(origptr, f); /* Compat v1.6 syntax */
cfrot(ptr, f); /* Compat v1.6 syntax */
opt = strtok(NULL, ",");
}
}