init: Make tty owned by logged in user

This commit is contained in:
Bananymous 2024-12-02 05:03:07 +02:00
parent 9d97964998
commit ffcc4fd03a
1 changed files with 6 additions and 0 deletions

View File

@ -77,6 +77,9 @@ int main(int argc, char** argv)
if (pwd == nullptr)
continue;
if (chown(tty_name, pwd->pw_uid, 0) == -1)
perror("chown");
pid_t pid = fork();
if (pid == 0)
{
@ -124,6 +127,9 @@ int main(int argc, char** argv)
if (tcsetpgrp(0, getpgrp()) == -1)
perror("tcsetpgrp");
if (chown(tty_name, 0, 0) == -1)
perror("chown");
}
}