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

Steve Lhomme robux4 at gmail.com
Mon Oct 3 09:25:17 CEST 2016


On Sat, Oct 1, 2016 at 3:42 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> 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);

Aren't all hardcoded strings in the code automatically static ?

That might be a problem if modules used this to set an environment
variable and then are unloaded, but that's currently not the case.

> But that's awful.
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list