55496e93d6
Hiramatsu Yoshifumi in PR pkg/26962. - Use ut_session only when it is available in struct utmpx. - If updwtmpx is not available, use pututxline instead. - Bulid functions using struct utmp only when the struct utmp is available.
57 lines
1.6 KiB
Text
57 lines
1.6 KiB
Text
$NetBSD: patch-ai,v 1.1 2004/09/15 18:29:20 minskim Exp $
|
|
|
|
--- src/logging.c.orig Sun Dec 15 18:33:04 2002
|
|
+++ src/logging.c
|
|
@@ -137,7 +137,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 +205,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 +260,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 +283,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 +339,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)
|