[PATCH] man: allow multiple paths in MANPATH

Marcel Rodrigues marcelgmr at gmail.com
Thu Nov 27 01:45:38 UTC 2014


2014-11-26 23:13 GMT-02:00 Denys Vlasenko <vda.linux at googlemail.com>:

> On Thu, Nov 27, 2014 at 1:32 AM, Marcel Rodrigues <marcelgmr at gmail.com>
> wrote:
> > The patch below unifies the code in a separated function. I have
> considered
> > using the strchr() approach, but ended up using strtok() because it is
> > simpler and both approaches required a writable buffer anyway. While it's
> > possible to refactor the new function to work with read-only buffers
> (such
> > as the one directly returned by getenv()), I don't know if it is worth
> the
>
> getenv() is not readonly.
>

POSIX says that "[t]he application shall ensure that it does not modify the
string pointed to by the getenv() function." I might be completely wrong
but my impression is that in practice the libc will just give you a pointer
to an entry in the environ static array, so if you mess with it, subsequent
calls to getenv() in the same process with the same argument will be messed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20141126/afb6534e/attachment.html>


More information about the busybox mailing list