From 06b2781fdf5a54fc0bf42321d47cad51010df023 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 1 Feb 1996 21:27:05 +0000 Subject: (main): Chown the terminal. --- utils/login.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/utils/login.c b/utils/login.c index 37bac81d..ba69429f 100644 --- a/utils/login.c +++ b/utils/login.c @@ -258,7 +258,7 @@ add_entry (char **env, unsigned *env_len, char *entry) error (8, err, "Adding %s", entry); } -void +void main(int argc, char *argv[]) { int i; @@ -848,6 +848,16 @@ main(int argc, char *argv[]) if (! no_utmp) add_utmp_entry (args, args_len, 0, !parent_has_uid (0)); + if (eff_uids->num | eff_gids->num) + { + /* Change the terminal to be owned by the user. */ + err = chown (tty, + eff_uids->num ? eff_uids->ids[0] : -1, + eff_gids->num ? eff_gids->ids[0] : -1); + if (err) + error (0, err, "chown: %s", tty); + } + err = file_exec (exec, mach_task_self (), EXEC_NEWTASK | EXEC_DEFAULTS | EXEC_SECURE, sh_args, sh_args_len, env, env_len, -- cgit v1.2.3