lkml.org 
[lkml]   [2001]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: More better in mount(2)
Date
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?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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