about summary refs log tree commit diff
path: root/login/logout.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/logout.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/logout.c')
-rw-r--r--login/logout.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/login/logout.c b/login/logout.c
index 3def97fc83..bf78e0915e 100644
--- a/login/logout.c
+++ b/login/logout.c
@@ -21,27 +21,28 @@
 #include <utmp.h>
 #include <time.h>
 #include <sys/time.h>
+#include <shlib-compat.h>
 
 int
-logout (const char *line)
+__logout (const char *line)
 {
   struct utmp tmp, utbuf;
   struct utmp *ut;
   int result = 0;
 
   /* Tell that we want to use the UTMP file.  */
-  if (utmpname (_PATH_UTMP) == -1)
+  if (__utmpname (_PATH_UTMP) == -1)
     return 0;
 
   /* Open UTMP file.  */
-  setutent ();
+  __setutent ();
 
   /* Fill in search information.  */
   tmp.ut_type = USER_PROCESS;
   strncpy (tmp.ut_line, line, sizeof tmp.ut_line);
 
   /* Read the record.  */
-  if (getutline_r (&tmp, &utbuf, &ut) >= 0)
+  if (__getutline_r (&tmp, &utbuf, &ut) >= 0)
     {
       /* Clear information about who & from where.  */
       memset (ut->ut_name, '\0', sizeof ut->ut_name);
@@ -52,12 +53,18 @@ logout (const char *line)
       TIMESPEC_TO_TIMEVAL (&ut->ut_tv, &ts);
       ut->ut_type = DEAD_PROCESS;
 
-      if (pututline (ut) != NULL)
+      if (__pututline (ut) != NULL)
 	result = 1;
     }
 
   /* Close UTMP file.  */
-  endutent ();
+  __endutent ();
 
   return result;
 }
+versioned_symbol (libc, __logout, logout, GLIBC_2_34);
+libc_hidden_ver (__logout, logout)
+
+#if OTHER_SHLIB_COMPAT (libutil, GLIBC_2_0, GLIBC_2_34)
+compat_symbol (libutil, __logout, logout, GLIBC_2_0);
+#endif