about summary refs log tree commit diff
path: root/login/login_tty.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-06-30 07:21:14 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-06-30 08:43:37 +0200
commit734c60ebb607086ad6d67b2544d6b7baba72a652 (patch)
tree3d0480b60b81da20b51df998f6585feeb85a8d14 /login/login_tty.c
parent98164ba55d01dfe517a71cbc5538ff1f5dc563d6 (diff)
downloadglibc-734c60ebb607086ad6d67b2544d6b7baba72a652.tar.gz
glibc-734c60ebb607086ad6d67b2544d6b7baba72a652.tar.xz
glibc-734c60ebb607086ad6d67b2544d6b7baba72a652.zip
login: Move libutil into libc
The symbols forkpty, login, login_tty, logout, logwtmp, openpty
were moved using scripts/move-symbol-to-libc.py.

This is a single commit because most of the symbols are tied together
via forkpty, for example.

Several changes to use hidden prototypes are needed.  This commit
also updates pseudoterminal terminology on modified lines.

For 390 (31-bit), this commit follows the existing style for the
compat symbol version creation.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'login/login_tty.c')
-rw-r--r--login/login_tty.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/login/login_tty.c b/login/login_tty.c
index a94f5cb861..a85b388482 100644
--- a/login/login_tty.c
+++ b/login/login_tty.c
@@ -37,13 +37,14 @@ static char sccsid[] = "@(#)login_tty.c	8.1 (Berkeley) 6/4/93";
 #include <unistd.h>
 #include <fcntl.h>
 #include <utmp.h>
+#include <shlib-compat.h>
 
 int
-login_tty (int fd)
+__login_tty (int fd)
 {
-	(void) setsid();
+	__setsid();
 #ifdef TIOCSCTTY
-	if (ioctl(fd, TIOCSCTTY, (char *)NULL) == -1)
+	if (__ioctl(fd, TIOCSCTTY, NULL) == -1)
 		return (-1);
 #else
 	{
@@ -53,24 +54,29 @@ login_tty (int fd)
 	  if (fdname)
 	    {
 	      if (fd != 0)
-		(void) close (0);
+		_close (0);
 	      if (fd != 1)
-		(void) close (1);
+		__close (1);
 	      if (fd != 2)
-		(void) close (2);
-	      newfd = open (fdname, O_RDWR);
-	      (void) close (newfd);
+		__close (2);
+	      newfd = __open64 (fdname, O_RDWR);
+	      __close (newfd);
 	    }
 	}
 #endif
-	while (dup2(fd, 0) == -1 && errno == EBUSY)
+	while (__dup2(fd, 0) == -1 && errno == EBUSY)
 	  ;
-	while (dup2(fd, 1) == -1 && errno == EBUSY)
+	while (__dup2(fd, 1) == -1 && errno == EBUSY)
 	  ;
-	while (dup2(fd, 2) == -1 && errno == EBUSY)
+	while (__dup2(fd, 2) == -1 && errno == EBUSY)
 	  ;
 	if (fd > 2)
-		(void) close(fd);
+		__close(fd);
 	return (0);
 }
-libutil_hidden_def (login_tty)
+versioned_symbol (libc, __login_tty, login_tty, GLIBC_2_34);
+libc_hidden_ver (__login_tty, login_tty)
+
+#if OTHER_SHLIB_COMPAT (libutil, GLIBC_2_0, GLIBC_2_34)
+compat_symbol (libutil, __login_tty, login_tty, GLIBC_2_0);
+#endif