Re: Including STRTOK_R in a LSM

From: Jan Engelhardt
Date: Mon Jul 16 2007 - 06:16:53 EST



On Jul 16 2007 16:52, Z. Cliffe Schreuders wrote:
>
> I am aware strtok was removed from the kernel in 2002. However strtok_r is more
> desirable than strsep as I do not want to know about 'blank fields' (2
> consecutive delimiters). Is it acceptable to simply include the strtok_r code
> in my security module? or should I create a wrapper for strsep to ignore
> blanks?

12:16 ichi:/dev/shm > cat test.c
#include <stdio.h>
#include <string.h>
int main(void)
{
char x[] = "foo::bar";
char *w = x;
char *p;
while ((p = strsep(&w, ":")) != NULL)
printf("\"%s\"\n", p);
}
12:16 ichi:/dev/shm > ./a.out
"foo"
""
"bar"


q.e.d.


Jan
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/