2014-11-26 23:13 GMT-02:00 Denys Vlasenko <[email protected]>:
> On Thu, Nov 27, 2014 at 1:32 AM, Marcel Rodrigues <[email protected]> > 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.
_______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
