Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37478605
en ru br
Репозитории ALT
S:1.01-alt4.1
5.1: 1.01-alt3
4.1: 1.01-alt3
4.0: 1.01-alt3
3.0: 1.01-alt2
www.altlinux.org/Changes

Группа :: Система/Основа
Пакет: 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;
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin