diff options
-rw-r--r-- | sysutils/jfbterm/files/patch-utmpx | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/sysutils/jfbterm/files/patch-utmpx b/sysutils/jfbterm/files/patch-utmpx new file mode 100644 index 000000000000..e385e17c1e8d --- /dev/null +++ b/sysutils/jfbterm/files/patch-utmpx @@ -0,0 +1,95 @@ +--- term.c.orig 2009-02-07 12:30:17.000000000 -0500 ++++ term.c 2010-01-28 13:40:25.000000000 -0500 +@@ -59,7 +59,11 @@ + #include <termios.h> + #include <time.h> + #include <unistd.h> ++#ifdef HAVE_UTMP_H + #include <utmp.h> ++#else ++#include <utmpx.h> ++#endif + + #if defined (__linux__) + #include <sys/vt.h> +@@ -523,6 +527,41 @@ static void writeLoginRecord(void) + pututline(&utmp); + endutent(); + privilege_off(); ++#elif defined (__FreeBSD__) && (__FreeBSD_version >= 900007) ++ struct utmpx utmp; ++ struct passwd *pw; ++ char *tn; ++ ++ assert(initialized); ++ ++ bzero(&utmp, sizeof(utmp)); ++ pw = getpwuid(privilege_getUID()); ++ if (pw == NULL) { ++ warnx("who are you?"); ++ return; /* give up */ ++ } ++ if (strncmp(self->device, "/dev/pts/", 9) == 0 || ++ strncmp(self->device, "/dev/tty", 8) == 0) { ++ /* Unix98 style: "/dev/pts/\*" */ ++ /* BSD style: "/dev/tty[l-sL-S][0-9a-v]" */ ++ tn = self->device + strlen("/dev/"); ++ if (strlen(tn) < 5) ++ return; /* bad format */ ++ strncpy(utmp.ut_id, tn, sizeof(utmp.ut_id)); ++ } else ++ return; /* bad format */ ++ utmp.ut_type = DEAD_PROCESS; ++ privilege_on(); ++ setutxent(); ++ getutxid(&utmp); ++ utmp.ut_type = USER_PROCESS; ++ utmp.ut_pid = getpid(); ++ strncpy(utmp.ut_line, tn, sizeof(utmp.ut_line)); ++ strncpy(utmp.ut_user, pw->pw_name, sizeof(utmp.ut_user)); ++ gettimeofday(&(utmp.ut_tv), NULL); ++ pututxline(&utmp); ++ endutxent(); ++ privilege_off(); + #elif defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) + struct utmp utmp; + struct passwd *pw; +@@ -600,6 +639,38 @@ static void eraseLoginRecord(void) + pututline(utp); + endutent(); + privilege_off(); ++#elif defined (__FreeBSD__) && (__FreeBSD_version >= 900007) ++ struct utmpx utmp, *utp; ++ char *tn; ++ ++ assert(initialized); ++ ++ bzero(&utmp, sizeof(utmp)); ++ if (strncmp(self->device, "/dev/pts/", 9) == 0 || ++ strncmp(self->device, "/dev/tty", 8) == 0) { ++ /* Unix98 style: "/dev/pts/\*" */ ++ /* BSD style: "/dev/tty[l-sL-S][0-9a-v]" */ ++ tn = self->device + strlen("/dev/"); ++ if (strlen(tn) < 5) ++ return; /* bad format */ ++ strncpy(utmp.ut_id, tn, sizeof(utmp.ut_id)); ++ } else ++ return; /* bad format */ ++ utmp.ut_type = USER_PROCESS; ++ privilege_on(); ++ setutxent(); ++ utp = getutxid(&utmp); ++ if (utp == NULL) { ++ endutxent(); ++ privilege_off(); ++ return; /* give up */ ++ } ++ utp->ut_type = DEAD_PROCESS; ++ bzero(utp->ut_user, sizeof(utmp.ut_user)); ++ gettimeofday(&(utp->ut_tv), NULL); ++ pututxline(utp); ++ endutxent(); ++ privilege_off(); + #elif defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) + struct utmp utmp; + char *tn; |