usage of strtok()

Enrik Berkhan enrik#freeradius at planb.de
Wed Jul 4 21:04:44 CEST 2007


Hi,

I've just noticed that strtok() is used in some places in FreeRADIUS,
e.g. in rlm_perl for tokenizing the xlat() arguments. IIRC, strtok() is
not thread safe.

What would be the best and most portable approach to avoid it? Use
strtok_r() if available and/or fall back to a strtok_r implementation
provided by FreeRADIUS like mystrtok() in src/lib/valuepair.c?

Enrik



More information about the Freeradius-Devel mailing list