mirror of
https://github.com/pygos/init.git
synced 2024-11-05 12:17:10 +01:00
9a88f7da45
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
23 lines
317 B
C
23 lines
317 B
C
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <stdio.h>
|
|
|
|
#include "init.h"
|
|
|
|
int setup_tty(void)
|
|
{
|
|
int fd;
|
|
|
|
fd = open("/dev/console", O_WRONLY | O_NOCTTY);
|
|
if (fd < 0) {
|
|
perror("/dev/console");
|
|
return -1;
|
|
}
|
|
|
|
close(STDIN_FILENO);
|
|
dup2(fd, STDOUT_FILENO);
|
|
dup2(fd, STDERR_FILENO);
|
|
|
|
close(fd);
|
|
return 0;
|
|
}
|