3 ms·
That’s literally explained in the article. It’s worth reading more than the headline. Ed: actually, that’s even spelled out in the headline.
by numbsafari 3y ago
That’s literally explained in the article. It’s worth reading more than the headline.
Ed: actually, that’s even spelled out in the headline.
- silisili 3y agoIt's not. OP was asking about setenv, not getenv...
- emmelaich 3y ago? setenv not getenv. You'd rarely use setenv, and even then you'd do it at startup.
- magicalhippo 3y agoRight. That's been my experience so far, hence my question.
- raggi 3y agoIt’s neither in the headline or in the article. The question was about setenv, not getenv. It is best to avoid calling setenv in a threaded program. Some programs do it to make space for rewriting argv with large strings (freeing space from *environ which tends to be right after the tail of argv). Some programs or libraries use *environ directly to stage variables for exec before forking. Some want to pass variable changes to forks. There are alternatives possible, but in the context of something like go calling libc setenv, it’s to make interop easier- sadly it may make other interop harder, such as this case.