Re:Don't setenv in multi-threaded code on glibc
by noselasd on Tuesday January 31, 2017 @10:06AM
(#13531088)
> how do you do that without interfering with other threads >that might do the same
You build up a the environment in a local variable, fork(), then have the child alter its environment based on the said local variable before it goes on to do useful stuff.
If you're just executing another program, do the same, but call execle() which takes the environment as an argument.
You build up a the environment in a local variable, fork(), then have the child alter its environment based on the said local variable before it goes on to do useful stuff.
If you're just executing another program, do the same, but call execle() which takes the environment as an argument.