[lkml]   [2001]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: More better in mount(2)
Daniel writes:
> [re strtok for mount option parsing]
> BUGS Never use this function. If you do, note that:
> This function modifies its first argument.
> The identity of the delimiting character is lost.
> This functions cannot be used on constant strings.
> The strtok() function uses a static buffer while
> parsing, so it's not thread safe. Use strtok_r()
> if this matters to you.

Luckily, when mount(8) is trying to mount a filesystem, it passes the
mount options into the kernel each time, which does copy_from_user(),
so the fact that strtok() breaks the data is OK. The only time this
is bad is with Stephen's ext3 rootflags option...

Cheers, Andreas
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?" -- Dogbert
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:52    [W:0.031 / U:1.928 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site