blob: f0be0a09a35533519dbdf4a65c76a895c3ce34e5 [file] [log] [blame] [edit]
#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;
}