init: Make tty owned by logged in user
This commit is contained in:
parent
9d97964998
commit
ffcc4fd03a
|
@ -77,6 +77,9 @@ int main(int argc, char** argv)
|
||||||
if (pwd == nullptr)
|
if (pwd == nullptr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (chown(tty_name, pwd->pw_uid, 0) == -1)
|
||||||
|
perror("chown");
|
||||||
|
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
{
|
{
|
||||||
|
@ -124,6 +127,9 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if (tcsetpgrp(0, getpgrp()) == -1)
|
if (tcsetpgrp(0, getpgrp()) == -1)
|
||||||
perror("tcsetpgrp");
|
perror("tcsetpgrp");
|
||||||
|
|
||||||
|
if (chown(tty_name, 0, 0) == -1)
|
||||||
|
perror("chown");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue