Skip to content

Commit

Permalink
src/sulogin.c: main(): Add local variable
Browse files Browse the repository at this point in the history
This simplifies the getpassa() call into a single line.

Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar committed Jan 23, 2025
1 parent 18c957d commit 96fcab4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/sulogin.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ main(int argc, char *argv[])
(void) alarm (ALARM); /* only wait so long ... */

do { /* repeatedly get login/password pairs */
char *pass;
char *pass;
const char *prompt;

if (pw_entry("root", &pwent) == -1) { /* get entry from password file */
/*
* Fail secure
Expand All @@ -143,12 +145,14 @@ main(int argc, char *argv[])
* Here we prompt for the root password, or if no password
* is given we just exit.
*/

/* get a password for root */
pass = getpassa(_(
prompt = _(
"\n"
"Type control-d to proceed with normal startup,\n"
"(or give root password for system maintenance):"));
"(or give root password for system maintenance):");

/* get a password for root */
pass = getpassa(prompt);

/*
* XXX - can't enter single user mode if root password is
* empty. I think this doesn't happen very often :-). But
Expand Down

0 comments on commit 96fcab4

Please sign in to comment.