Description of problem: In init.c the following code exists on line 947 in spawn(): if (pid > 0) { /* * Ignore keyboard signals etc. * Then wait for child to exit. */ SETSIG(sa, SIGINT, SIG_IGN, SA_RESTART); SETSIG(sa, SIGTSTP, SIG_IGN, SA_RESTART); SETSIG(sa, SIGQUIT, SIG_IGN, SA_RESTART); SETSIG(sa, SIGCHLD, SIG_DFL, SA_RESTART); while ((f = waitpid(pid, &st, 0)) != pid) if (f < 0 && errno == ECHILD) break; /* * Small optimization. See if stealing * controlling tty back is needed. */ pgrp = tcgetpgrp(f); if (pgrp != getpid()) exit(0); If f is set in the while loop then it is set to a pid_t (which is an int), whereas tcgetpgrp expects a filedescriptor of a tty (which is also an int thus explaining why it even compiles). Up above in the code he actually opens the console and sets f to the fd of the console. The intervening code with waitpid, though, will overwrite the value of the fd. I don't fully understand the repurcussions of this but its certainly wrong. Version-Release number of selected component (if applicable): 2.84-13 How reproducible: N/A Steps to Reproduce: N/A Actual results: N/A Expected results: N/A Additional info: The fix is to use another variable other than f to capture the return code of waitpid(): while ((gotpid = waitpid(pid, &st, 0)) != pid) if (gotpid < 0 && errno == ECHILD) break; Of course intializing the new variable is required also.
This is fixed in 2.85-1 and later.