Re: More better in mount(2)

Andreas Dilger (adilger@turbolinux.com)
Fri, 5 Jan 2001 13:26:16 -0700 (MST)


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/