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