[vlc-devel] [PATCH] tests: replace setenv() with putenv() for static values

Rémi Denis-Courmont remi at remlab.net
Sat Oct 1 15:42:54 CEST 2016


Le samedi 1 octobre 2016, 14:41:07 Steve Lhomme a écrit :
> On Fri, Sep 30, 2016 at 7:45 PM,  <remi at remlab.net> wrote:
> > Hello,
> > 
> > putenv() is a piece of crap almost on gets() level. I wouldn't be
> > surprised
> > if it is pr woll be deprecated by POSIX. Please, no.
> > 
> > Besides, I suspecy this breaks our own Linux code.
> > 
> > Le 30 sept. 2016 03:46, Steve Lhomme <robux4 at videolabs.io> a écrit :
> >> Since setenv() is leaky
> > 
> > And putenv() requires the caller to leak. No better.
> 
> But in this case we use strings that are static so won't leak.

Yes, if you do this:

static char envstr[] = "NAME=value";

putenv(envstr);

But that's awful.

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list