Репозитории ALT
Группа :: Система/Основа
Пакет: mingetty
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: mingetty-1.01-alt-std_fd.patch
Скачать
Скачать
--- mingetty-1.00~/mingetty.c 2002-06-04 16:10:15 +0400
+++ mingetty-1.00/mingetty.c 2002-06-04 16:11:46 +0400
@@ -188,7 +188,7 @@
don't have to modify the tty device for sane settings.
We also get a SIGHUP/SIGCONT.
*/
- if ((fd = open (buf, O_RDWR, 0)) < 0
+ if ((fd = open (buf, O_RDWR)) < 0
|| ioctl (fd, TIOCSCTTY, (void *)1) == -1)
error ("%s: cannot open tty: %s", buf, strerror(errno));
if (!isatty (fd))
@@ -203,18 +203,22 @@
close (fd);
/* ioctl (0, TIOCNOTTY, (char *)1); */
- if (open (buf, O_RDWR, 0) != 0)
+ if (open (buf, O_RDONLY) != 0)
error ("%s: cannot open as standard input: %s", buf,
strerror(errno));
+ if (open (buf, O_WRONLY) != 1)
+ error ("%s: cannot open as standard output: %s", buf,
+ strerror(errno));
+
/* Set up standard output and standard error file descriptors. */
- if (dup (0) != 1 || dup (0) != 2)
+ if (dup (1) != 2)
error ("%s: dup problem: %s", buf, strerror(errno));
/* Write a reset string to the terminal. This is very linux-specific
and should be checked for other systems. */
if (! noclear)
- write (0, "\033c", 2);
+ write (1, "\033c", 2);
sa.sa_handler = SIG_DFL;
sa.sa_flags = 0;