Re:In C, how do you know if the dynamic allocation succeeded?
by jagrsw on Saturday November 06, 2021 @05:28AM
(#29128757)
I think setenv() will use malloc() (it might use mutexes), same for error printing if it uses printf() or perror().
Also, this is all mess if fork() is called from a multi-threaded context. Esp. via clone(), which up to certain glibc() version cached getpid() result, and returned parent'd PID in the child (for performance reasons of course ;).
Also, this is all mess if fork() is called from a multi-threaded context. Esp. via clone(), which up to certain glibc() version cached getpid() result, and returned parent'd PID in the child (for performance reasons of course ;).