| @@ -1,25 +1,78 @@ | | | @@ -1,25 +1,78 @@ |
1 | $NetBSD: patch-ak,v 1.2 2005/06/16 10:47:43 hira Exp $ | | 1 | $NetBSD: patch-ak,v 1.3 2012/07/09 19:06:22 joerg Exp $ |
2 | | | 2 | |
3 | --- src/logging.c.orig 2005-01-16 16:33:20.000000000 -0500 | | 3 | --- src/logging.c.orig 2002-12-16 00:33:04.000000000 +0000 |
4 | +++ src/logging.c 2005-01-16 16:55:25.000000000 -0500 | | 4 | +++ src/logging.c |
5 | @@ -66,9 +66,7 @@ | | 5 | @@ -66,9 +66,7 @@ rxvt_makeutent(rxvt_t *r, const char *pt |
6 | #ifdef HAVE_STRUCT_UTMPX | | 6 | #ifdef HAVE_STRUCT_UTMPX |
7 | struct utmpx *utx = &(r->h->utx); | | 7 | struct utmpx *utx = &(r->h->utx); |
8 | #endif | | 8 | #endif |
9 | -#ifdef HAVE_UTMP_PID | | 9 | -#ifdef HAVE_UTMP_PID |
10 | int i; | | 10 | int i; |
11 | -#endif | | 11 | -#endif |
12 | char ut_id[5]; | | 12 | char ut_id[5]; |
13 | struct passwd *pwent = getpwuid(getuid()); | | 13 | struct passwd *pwent = getpwuid(getuid()); |
14 | | | 14 | |
15 | @@ -78,10 +76,8 @@ | | 15 | @@ -78,10 +76,8 @@ rxvt_makeutent(rxvt_t *r, const char *pt |
16 | if (!STRNCMP(pty, "pty", 3) || !STRNCMP(pty, "tty", 3)) { | | 16 | if (!STRNCMP(pty, "pty", 3) || !STRNCMP(pty, "tty", 3)) { |
17 | STRNCPY(ut_id, (pty + 3), sizeof(ut_id)); | | 17 | STRNCPY(ut_id, (pty + 3), sizeof(ut_id)); |
18 | } | | 18 | } |
19 | -#ifdef HAVE_UTMP_PID | | 19 | -#ifdef HAVE_UTMP_PID |
20 | else if (sscanf(pty, "pts/%d", &i) == 1) | | 20 | else if (sscanf(pty, "pts/%d", &i) == 1) |
21 | sprintf(ut_id, "vt%02x", (i & 0xff)); /* sysv naming */ | | 21 | sprintf(ut_id, "vt%02x", (i & 0xff)); /* sysv naming */ |
22 | -#endif | | 22 | -#endif |
23 | else if (STRNCMP(pty, "pty", 3) && STRNCMP(pty, "tty", 3)) { | | 23 | else if (STRNCMP(pty, "pty", 3) && STRNCMP(pty, "tty", 3)) { |
24 | rxvt_print_error("can't parse tty name \"%s\"", pty); | | 24 | rxvt_print_error("can't parse tty name \"%s\"", pty); |
25 | return; | | 25 | return; |
| | | 26 | @@ -137,7 +133,9 @@ rxvt_makeutent(rxvt_t *r, const char *pt |
| | | 27 | STRNCPY(utx->ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?", |
| | | 28 | sizeof(utx->ut_user)); |
| | | 29 | STRNCPY(utx->ut_id, ut_id, sizeof(utx->ut_id)); |
| | | 30 | +# ifdef HAVE_UTMPX_SESSION |
| | | 31 | utx->ut_session = getsid(0); |
| | | 32 | +# endif |
| | | 33 | utx->ut_tv.tv_sec = time(NULL); |
| | | 34 | utx->ut_tv.tv_usec = 0; |
| | | 35 | utx->ut_pid = r->h->cmd_pid; |
| | | 36 | @@ -203,7 +201,11 @@ rxvt_makeutent(rxvt_t *r, const char *pt |
| | | 37 | # endif |
| | | 38 | # endif |
| | | 39 | # ifdef HAVE_STRUCT_UTMPX |
| | | 40 | +# ifdef HAVE_UPDWTMPX |
| | | 41 | updwtmpx(RXVT_WTMPX_FILE, utx); |
| | | 42 | +# else |
| | | 43 | + pututxline(utx); |
| | | 44 | +# endif |
| | | 45 | # endif |
| | | 46 | } |
| | | 47 | #endif |
| | | 48 | @@ -254,7 +256,9 @@ rxvt_cleanutent(rxvt_t *r) |
| | | 49 | if ((tmputx = getutxid(utx))) /* position to entry in utmp file */ |
| | | 50 | utx = tmputx; |
| | | 51 | utx->ut_type = DEAD_PROCESS; |
| | | 52 | +# ifdef HAVE_UTMPX_SESSION |
| | | 53 | utx->ut_session = getsid(0); |
| | | 54 | +# endif |
| | | 55 | utx->ut_tv.tv_sec = time(NULL); |
| | | 56 | utx->ut_tv.tv_usec = 0; |
| | | 57 | #endif |
| | | 58 | @@ -275,7 +279,11 @@ rxvt_cleanutent(rxvt_t *r) |
| | | 59 | # endif |
| | | 60 | # endif |
| | | 61 | # ifdef HAVE_STRUCT_UTMPX |
| | | 62 | +# ifdef HAVE_UPDWTMPX |
| | | 63 | updwtmpx(RXVT_WTMPX_FILE, utx); |
| | | 64 | +# else |
| | | 65 | + pututxline(utx); |
| | | 66 | +# endif |
| | | 67 | # endif |
| | | 68 | } |
| | | 69 | #endif |
| | | 70 | @@ -327,7 +335,7 @@ rxvt_write_bsd_utmp(int utmp_pos, struct |
| | | 71 | /* |
| | | 72 | * Update a BSD style wtmp entry |
| | | 73 | */ |
| | | 74 | -#if defined(WTMP_SUPPORT) && !defined(HAVE_UPDWTMP) |
| | | 75 | +#if defined(WTMP_SUPPORT) && !defined(HAVE_UPDWTMP) && defined(HAVE_STRUCT_UTMP) |
| | | 76 | /* INTPROTO */ |
| | | 77 | void |
| | | 78 | rxvt_update_wtmp(const char *fname, const struct utmp *putmp) |