summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-02-01 21:27:05 +0000
committerRoland McGrath <roland@gnu.org>1996-02-01 21:27:05 +0000
commit06b2781fdf5a54fc0bf42321d47cad51010df023 (patch)
tree49a8cb619d40aaf57c1cb73115ac16ff9cb09a3e /utils
parent7ec39756ac282b19087d895601b04e17c0cdf26d (diff)
(main): Chown the terminal.
Diffstat (limited to 'utils')
-rw-r--r--utils/login.c12
1 files changed, 11 insertions, 1 deletions
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,