mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-17 13:00:43 +08:00
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.
This commit is contained in:
parent
d60d215c57
commit
1483b75378
@ -1,3 +1,10 @@
|
||||
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.
|
||||
|
||||
1999-05-14 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* nss/getXXbyYY.c: Add free_mem function which disposes all
|
||||
|
@ -755,12 +755,6 @@ nss_new_service (name_database *database, const char *name)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
nothing (void *ptr __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* Free all resources if necessary. */
|
||||
static void __attribute__ ((unused))
|
||||
free_mem (void)
|
||||
@ -787,7 +781,7 @@ free_mem (void)
|
||||
service_user *olds = service;
|
||||
|
||||
if (service->known != NULL)
|
||||
__tdestroy (service->known, nothing);
|
||||
__tdestroy (service->known, free);
|
||||
|
||||
service = service->next;
|
||||
free (olds);
|
||||
|
@ -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;
|
||||
utmp->ut_pid = utmpx->ut_pid;
|
||||
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));
|
||||
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_PID - 0
|
||||
utmp->ut_pid = utmpx->ut_pid;
|
||||
#endif
|
||||
memcpy (utmp->ut_line, utmpx->ut_line, sizeof (utmp->ut_line));
|
||||
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));
|
||||
#endif
|
||||
#if _HAVE_UT_TV - 0
|
||||
utmp->ut_tv = utmpx->ut_tv;
|
||||
#else
|
||||
utmp->ut_time = utmpx->ut_time;
|
||||
#endif
|
||||
}
|
||||
|
@ -16,25 +16,33 @@
|
||||
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 UTMP to UTMPX. */
|
||||
void
|
||||
getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
|
||||
{
|
||||
memset (utmpx, 0, sizeof (struct utmpx));
|
||||
|
||||
#if _HAVE_UT_TYPE - 0
|
||||
utmpx->ut_type = utmp->ut_type;
|
||||
utmpx->ut_pid = utmp->ut_pid;
|
||||
memcpy (utmpx->ut_line, utmp->ut_line, sizeof (utmpx->ut_line));
|
||||
memcpy (utmpx->ut_id, utmp->ut_id, sizeof (utmpx->ut_id));
|
||||
memcpy (utmpx->ut_user, utmp->ut_user, sizeof (utmpx->ut_user));
|
||||
memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmpx->ut_host));
|
||||
#ifdef _GNU_SOURCE
|
||||
utmpx->ut_exit.e_termination = utmp->ut_exit.e_termination;
|
||||
utmpx->ut_exit.e_exit = utmp->ut_exit.e_exit;
|
||||
#else
|
||||
utmpx->ut_exit.__e_termination = utmp->ut_exit.e_termination;
|
||||
utmpx->ut_exit.__e_exit = utmp->ut_exit.e_exit;
|
||||
#endif
|
||||
utmpx->ut_session = utmp->ut_session;
|
||||
#if _HAVE_UT_PID - 0
|
||||
utmpx->ut_pid = utmp->ut_pid;
|
||||
#endif
|
||||
memcpy (utmpx->ut_line, utmp->ut_line, sizeof (utmp->ut_line));
|
||||
memcpy (utmpx->ut_user, utmp->ut_user, sizeof (utmp->ut_user));
|
||||
#if _HAVE_UT_ID - 0
|
||||
memcpy (utmpx->ut_id, utmp->ut_id, sizeof (utmp->ut_id));
|
||||
#endif
|
||||
#if _HAVE_UT_HOST - 0
|
||||
memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmp->ut_host));
|
||||
#endif
|
||||
#if _HAVE_UT_TV - 0
|
||||
utmpx->ut_tv = utmp->ut_tv;
|
||||
#else
|
||||
utmpx->ut_time = utmp->ut_time;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user