about summary refs log tree commit diff
path: root/login/login.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.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.c')
-rw-r--r--login/login.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/login/login.c b/login/login.c
index d280c13f1f..c95b98416a 100644
--- a/login/login.c
+++ b/login/login.c
@@ -23,7 +23,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <utmp.h>
-
+#include <shlib-compat.h>
 
 /* Return the result of ttyname in the buffer pointed to by TTY, which should
    be of length BUF_LEN.  If it is too long to fit in this buffer, a
@@ -41,7 +41,7 @@ tty_name (int fd, char **tty, size_t buf_len)
 
       if (buf_len)
 	{
-	  rv = ttyname_r (fd, buf, buf_len);
+	  rv = __ttyname_r (fd, buf, buf_len);
 
 	  if (rv != 0 || memchr (buf, '\0', buf_len))
 	    /* We either got an error, or we succeeded and the
@@ -78,7 +78,7 @@ tty_name (int fd, char **tty, size_t buf_len)
 }
 
 void
-login (const struct utmp *ut)
+__login (const struct utmp *ut)
 {
 #ifdef PATH_MAX
   char _tty[PATH_MAX + UT_LINESIZE];
@@ -114,16 +114,16 @@ login (const struct utmp *ut)
       strncpy (copy.ut_line, ttyp, UT_LINESIZE);
 
       /* Tell that we want to use the UTMP file.  */
-      if (utmpname (_PATH_UTMP) == 0)
+      if (__utmpname (_PATH_UTMP) == 0)
 	{
 	  /* Open UTMP file.  */
-	  setutent ();
+	  __setutent ();
 
 	  /* Write the entry.  */
-	  pututline (&copy);
+	  __pututline (&copy);
 
 	  /* Close UTMP file.  */
-	  endutent ();
+	  __endutent ();
 	}
 
       if (tty != _tty)
@@ -135,5 +135,11 @@ login (const struct utmp *ut)
     strncpy (copy.ut_line, "???", UT_LINESIZE);
 
   /* Update the WTMP file.  Here we have to add a new entry.  */
-  updwtmp (_PATH_WTMP, &copy);
+  __updwtmp (_PATH_WTMP, &copy);
 }
+versioned_symbol (libc, __login, login, GLIBC_2_34);
+libc_hidden_ver (__login, login)
+
+#if OTHER_SHLIB_COMPAT (libutil, GLIBC_2_0, GLIBC_2_34)
+compat_symbol (libutil, __login, login, GLIBC_2_0);
+#endif