pkgsrc/x11/rxvt/patches/patch-ak

78 lines
2.3 KiB
Text

$NetBSD: patch-ak,v 1.3 2012/07/09 19:06:22 joerg Exp $
--- src/logging.c.orig 2002-12-16 00:33:04.000000000 +0000
+++ src/logging.c
@@ -66,9 +66,7 @@ rxvt_makeutent(rxvt_t *r, const char *pt
#ifdef HAVE_STRUCT_UTMPX
struct utmpx *utx = &(r->h->utx);
#endif
-#ifdef HAVE_UTMP_PID
int i;
-#endif
char ut_id[5];
struct passwd *pwent = getpwuid(getuid());
@@ -78,10 +76,8 @@ rxvt_makeutent(rxvt_t *r, const char *pt
if (!STRNCMP(pty, "pty", 3) || !STRNCMP(pty, "tty", 3)) {
STRNCPY(ut_id, (pty + 3), sizeof(ut_id));
}
-#ifdef HAVE_UTMP_PID
else if (sscanf(pty, "pts/%d", &i) == 1)
sprintf(ut_id, "vt%02x", (i & 0xff)); /* sysv naming */
-#endif
else if (STRNCMP(pty, "pty", 3) && STRNCMP(pty, "tty", 3)) {
rxvt_print_error("can't parse tty name \"%s\"", pty);
return;
@@ -137,7 +133,9 @@ rxvt_makeutent(rxvt_t *r, const char *pt
STRNCPY(utx->ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
sizeof(utx->ut_user));
STRNCPY(utx->ut_id, ut_id, sizeof(utx->ut_id));
+# ifdef HAVE_UTMPX_SESSION
utx->ut_session = getsid(0);
+# endif
utx->ut_tv.tv_sec = time(NULL);
utx->ut_tv.tv_usec = 0;
utx->ut_pid = r->h->cmd_pid;
@@ -203,7 +201,11 @@ rxvt_makeutent(rxvt_t *r, const char *pt
# endif
# endif
# ifdef HAVE_STRUCT_UTMPX
+# ifdef HAVE_UPDWTMPX
updwtmpx(RXVT_WTMPX_FILE, utx);
+# else
+ pututxline(utx);
+# endif
# endif
}
#endif
@@ -254,7 +256,9 @@ rxvt_cleanutent(rxvt_t *r)
if ((tmputx = getutxid(utx))) /* position to entry in utmp file */
utx = tmputx;
utx->ut_type = DEAD_PROCESS;
+# ifdef HAVE_UTMPX_SESSION
utx->ut_session = getsid(0);
+# endif
utx->ut_tv.tv_sec = time(NULL);
utx->ut_tv.tv_usec = 0;
#endif
@@ -275,7 +279,11 @@ rxvt_cleanutent(rxvt_t *r)
# endif
# endif
# ifdef HAVE_STRUCT_UTMPX
+# ifdef HAVE_UPDWTMPX
updwtmpx(RXVT_WTMPX_FILE, utx);
+# else
+ pututxline(utx);
+# endif
# endif
}
#endif
@@ -327,7 +335,7 @@ rxvt_write_bsd_utmp(int utmp_pos, struct
/*
* Update a BSD style wtmp entry
*/
-#if defined(WTMP_SUPPORT) && !defined(HAVE_UPDWTMP)
+#if defined(WTMP_SUPPORT) && !defined(HAVE_UPDWTMP) && defined(HAVE_STRUCT_UTMP)
/* INTPROTO */
void
rxvt_update_wtmp(const char *fname, const struct utmp *putmp)