Gitiles
Code Review
Sign In
gerrit-public.fairphone.software
/
platform
/
external
/
musl
/
65c8be380431eebe4d70d130bd38563f8df9a7d7
/
.
/
src
/
misc
/
login_tty.c
blob: f0be0a09a35533519dbdf4a65c76a895c3ce34e5 [
file
] [
log
] [
blame
]
#include
<utmp.h>
#include
<sys/ioctl.h>
#include
<unistd.h>
int
login_tty
(
int
fd
)
{
setsid
();
if
(
ioctl
(
fd
,
TIOCSCTTY
,
(
char
*)
0
))
return
-
1
;
dup2
(
fd
,
0
);
dup2
(
fd
,
1
);
dup2
(
fd
,
2
);
if
(
fd
>
2
)
close
(
fd
);
return
0
;
}