Skip to content

src/login.c: fixed check for "init" process, when PAM is not used #1286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Karlson2k
Copy link

When 'login' is started as 'init' process it has PID == 1. If PAM is not used, 'login' does not fork itself and getppid() return 0. To simplify the code, check for own PID before forking which gives correct value ('1' for 'init' process) for both PAM and non-PAM builds.

Initially the code for 'init' mode was introduced to support starting by init=/bin/login.
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=374547

When 'login' is started as 'init' process it has PID == 1.
If PAM is not used, 'login' does not fork itself and getppid() return 0.
To simplify the code, check for own PID before forking which gives
correct value ('1' for 'init' process) for both PAM and non-PAM builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant