lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Jul 20, 2018 at 8:07 AM Andrew Gierth <andrew@tao11.riddles.org.uk> wrote:

> The problem with putenv() is that it does not copy the supplied string, it just puts a pointer to it into the environment.

"Thus, it is an error is to call putenv() with an automatic variable as the argument, then return from the calling function while string is still part of the environment." [1] Which is exactly what the posted code is doing.

Cheers,
V.

[1] http://man7.org/linux/man-pages/man3/putenv.3.html