about summary refs log tree commit diff
path: root/sysdeps/generic/getutmp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-05-14 21:30:22 +0000
committerUlrich Drepper <drepper@redhat.com>1999-05-14 21:30:22 +0000
commit1483b7537883c00276b91f8c35496594edd5b073 (patch)
tree2fa8096ac53daa0d1c3f837a0aefc466ebfc033f /sysdeps/generic/getutmp.c
parentd60d215c57261eb35e540fa13c04f6dc0957c476 (diff)
downloadglibc-1483b7537883c00276b91f8c35496594edd5b073.tar.gz
glibc-1483b7537883c00276b91f8c35496594edd5b073.tar.xz
glibc-1483b7537883c00276b91f8c35496594edd5b073.zip
Update.
1999-05-14  Mark Kettenis  <kettenis@gnu.org>

	* sysdeps/generic/getutmp.c: Include <string.h>
	(getutmp): Rewrite to only copy those members that are really
	present in `struct utmp'.
	* sysdeps/generic/getutmpx.c: Likewise.
Diffstat (limited to 'sysdeps/generic/getutmp.c')
-rw-r--r--sysdeps/generic/getutmp.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/sysdeps/generic/getutmp.c b/sysdeps/generic/getutmp.c
index 317a886752..0d3bf05bd8 100644
--- a/sysdeps/generic/getutmp.c
+++ b/sysdeps/generic/getutmp.c
@@ -16,25 +16,31 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <string.h>
 #include <utmp.h>
 #include <utmpx.h>
 
+/* Copy the information in UTMPX to UTMP. */
 void
 getutmp (const struct utmpx *utmpx, struct utmp *utmp)
 {
+#if _HAVE_UT_TYPE - 0
   utmp->ut_type = utmpx->ut_type;
+#endif
+#if _HAVE_UT_PID - 0
   utmp->ut_pid = utmpx->ut_pid;
+#endif
   memcpy (utmp->ut_line, utmpx->ut_line, sizeof (utmp->ut_line));
-  memcpy (utmp->ut_id, utmpx->ut_id, sizeof (utmp->ut_id));
   memcpy (utmp->ut_user, utmpx->ut_user, sizeof (utmp->ut_user));
+#if _HAVE_UT_ID - 0
+  memcpy (utmp->ut_id, utmpx->ut_id, sizeof (utmp->ut_id));
+#endif
+#if _HAVE_UT_HOST - 0
   memcpy (utmp->ut_host, utmpx->ut_host, sizeof (utmp->ut_host));
-#ifdef _GNU_SOURCE
-  utmp->ut_exit.e_termination = utmpx->ut_exit.e_termination;
-  utmp->ut_exit.e_exit = utmpx->ut_exit.e_exit;
-#else
-  utmp->ut_exit.__e_termination = utmpx->ut_exit.e_termination;
-  utmp->ut_exit.__e_exit = utmpx->ut_exit.e_exit;
 #endif
-  utmp->ut_session = utmpx->ut_session;
+#if _HAVE_UT_TV - 0
   utmp->ut_tv = utmpx->ut_tv;
+#else
+  utmp->ut_time = utmpx->ut_time;
+#endif
 }