2013-09-26 17:14:40 +02:00

37 lines
1.0 KiB
Plaintext

$NetBSD: patch-ab,v 1.5 2002/10/16 15:01:25 bouyer Exp $
--- src/utmp.c.orig Sun Mar 5 12:21:34 2000
+++ src/utmp.c Wed Oct 16 16:53:32 2002
@@ -71,7 +71,7 @@
#ifdef WTMP_SUPPORT
/* PROTO */
void
-wterm_update_wtmp(char *fname, struct utmp *putmp)
+wterm_update_wtmp(char *fname, UTMP *putmp)
{
int fd, retry = 10; /* 10 attempts at locking */
struct flock lck; /* fcntl locking scheme */
@@ -90,7 +90,7 @@
close(fd);
return; /* failed for unknown reason: give up */
}
- write(fd, putmp, sizeof(struct utmp));
+ write(fd, putmp, sizeof(UTMP));
/* unlocking the file */
lck.l_type = F_UNLCK;
@@ -218,8 +218,13 @@
#endif /* HAVE_UTMP_HOST */
/* ut_name is normally the same as ut_user, but .... */
+#ifdef HAVE_UTMPX_H
+ STRNCPY(utmp.ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
+ sizeof(utmp.ut_user));
+#else
STRNCPY(utmp.ut_name, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
sizeof(utmp.ut_name));
+#endif
utmp.ut_pid = getpid();