Skip to content

Commit 6528628

Browse files
committed
getty: improve argument handling when launching login
Add explicit argument separator before username to ensure correct parsing of the login command regardless of username format. This follows best practices for command execution and prevents unexpected behavior when processing special characters in usernames. Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 1480657 commit 6528628

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/getty.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ static int exec_login(char *name)
312312
struct stat st;
313313

314314
if (passenv)
315-
execl(_PATH_LOGIN, _PATH_LOGIN, "-p", name, NULL);
315+
execl(_PATH_LOGIN, _PATH_LOGIN, "-p", "--", name, NULL);
316316
else
317-
execl(_PATH_LOGIN, _PATH_LOGIN, name, NULL);
317+
execl(_PATH_LOGIN, _PATH_LOGIN, "--", name, NULL);
318318

319319
/*
320320
* Failed to exec login, should not happen on normal systems.

0 commit comments

Comments
 (0)