syslogd: cfopts(): reinit strtok() so both OPT1,OPT2 are found
Signed-off-by: Steffen Nurpmeso <steffen@sdaoden.eu> Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
ee47b88cd2
commit
d75858100c
@ -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;
|
char *opt, *origptr;
|
||||||
|
|
||||||
/* 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,11 +2346,17 @@ static void cfopts(char *ptr, struct filed *f)
|
|||||||
if (*ptr != ';')
|
if (*ptr != ';')
|
||||||
*ptr++ = 0;
|
*ptr++ = 0;
|
||||||
|
|
||||||
opt = strtok(ptr, ";");
|
origptr = ptr;
|
||||||
if (!opt)
|
ptr = strtok(ptr, ";");
|
||||||
|
if (!ptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (opt) {
|
for (;;) {
|
||||||
|
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;
|
||||||
@ -2360,9 +2366,7 @@ 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(ptr, f); /* Compat v1.6 syntax */
|
cfrot(origptr, f); /* Compat v1.6 syntax */
|
||||||
|
|
||||||
opt = strtok(NULL, ",");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user