Don't setenv in multi-threaded code on glibc
rachelbythebay.com
rachelbythebay.com
https://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/sete...
Discussed back then:
https://news.ycombinator.com/item?id=13528407 (104 comments)
Edit: hmm I guess variables like LD_PRELOAD and PATH that get used by the standard lib you might want to set. Or if any other libraries modify their runtime behavior based on env vars.
There's also the use-case of wrapper programs; programs which do a thing and then call exec. If the wrapper wants to set environment variables for the exec'd program, you could use execvpe, but setenv + execvp is simpler.