When PAM is not used, login does not fork itself so its own PID should
be checked instead of parent PID.
Fixes: b44a6c316d96ab038492c63443156810670d176d (26-12-2007; "If started as init, login and sulogin need to start a new session.")
Signed-off-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
#endif
/* If we were init, we need to start a new session */
- if (getppid() == 1) {
+ if (1 == initial_pid) {
setsid();
if (ioctl(0, TIOCSCTTY, 1) != 0) {
fprintf (stderr, _("TIOCSCTTY failed on %s"), tty);