Move the initialization of push_dir, which calls getcwd, to early in main.
The reason for that is that on SVR2-based UTS 2.1.2 (which along with many other old systems implements getcwd by forking "pwd") getcwd hangs when called when other child processes are running. I also added a quick return from push_dir if name == NULL so it doesn't actually have to chdir anywhere when just initializing. An initializing call to push_dir("/",0) had previously been put in at the beginning of daemon_main() to avoid calling getcwd after a chroot, but since that is no longer I needed I removed it and changed the call to chdir("/") after chroot into a push_dir("/",0) so it will remember the correct current directory.
Showing
Please register or sign in to comment