… | |
… | |
37 | * |
37 | * |
38 | * Private: |
38 | * Private: |
39 | * rxvt_update_wtmp (); |
39 | * rxvt_update_wtmp (); |
40 | *----------------------------------------------------------------------*/ |
40 | *----------------------------------------------------------------------*/ |
41 | |
41 | |
42 | #include "../config.h" /* NECESSARY */ |
42 | #include "../config.h" |
43 | #include "rxvt.h" /* NECESSARY */ |
43 | #include "rxvt.h" |
44 | #include "logging.h" |
44 | #include "logging.h" |
|
|
45 | |
45 | #ifdef UTMP_SUPPORT |
46 | #ifdef UTMP_SUPPORT |
46 | |
47 | |
47 | #if HAVE_STRUCT_UTMP |
48 | #if HAVE_STRUCT_UTMP |
48 | int rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu); |
49 | int rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu); |
49 | void rxvt_update_wtmp (const char *fname, const struct utmp *putmp); |
50 | void rxvt_update_wtmp (const char *fname, const struct utmp *putmp); |
… | |
… | |
97 | # ifdef HAVE_UTMP_PID |
98 | # ifdef HAVE_UTMP_PID |
98 | setutent (); |
99 | setutent (); |
99 | strncpy (ut->ut_id, ut_id, sizeof (ut->ut_id)); |
100 | strncpy (ut->ut_id, ut_id, sizeof (ut->ut_id)); |
100 | ut->ut_type = DEAD_PROCESS; |
101 | ut->ut_type = DEAD_PROCESS; |
101 | getutid (ut); /* position to entry in utmp file */ |
102 | getutid (ut); /* position to entry in utmp file */ |
102 | strncpy (ut_id, ut_id, sizeof (ut_id)); |
103 | strncpy (this->ut_id, ut_id, sizeof (this->ut_id)); |
103 | # endif |
104 | # endif |
104 | #endif |
105 | #endif |
105 | |
106 | |
106 | #ifdef HAVE_STRUCT_UTMPX |
107 | #ifdef HAVE_STRUCT_UTMPX |
107 | memset (utx, 0, sizeof (struct utmpx)); |
108 | memset (utx, 0, sizeof (struct utmpx)); |
108 | setutxent (); |
109 | setutxent (); |
109 | strncpy (utx->ut_id, ut_id, sizeof (utx->ut_id)); |
110 | strncpy (utx->ut_id, ut_id, sizeof (utx->ut_id)); |
110 | utx->ut_type = DEAD_PROCESS; |
111 | utx->ut_type = DEAD_PROCESS; |
111 | getutxid (utx); /* position to entry in utmp file */ |
112 | getutxid (utx); /* position to entry in utmp file */ |
112 | strncpy (ut_id, ut_id, sizeof (ut_id)); |
113 | strncpy (this->ut_id, ut_id, sizeof (this->ut_id)); |
113 | #endif |
114 | #endif |
114 | |
115 | |
115 | #ifdef HAVE_STRUCT_UTMP |
116 | #ifdef HAVE_STRUCT_UTMP |
116 | strncpy (ut->ut_line, pty, sizeof (ut->ut_line)); |
117 | strncpy (ut->ut_line, pty, sizeof (ut->ut_line)); |
117 | ut->ut_time = time (NULL); |
118 | ut->ut_time = time (NULL); |
… | |
… | |
245 | |
246 | |
246 | #ifdef HAVE_STRUCT_UTMP |
247 | #ifdef HAVE_STRUCT_UTMP |
247 | # ifdef HAVE_UTMP_PID |
248 | # ifdef HAVE_UTMP_PID |
248 | memset (ut, 0, sizeof (struct utmp)); |
249 | memset (ut, 0, sizeof (struct utmp)); |
249 | setutent (); |
250 | setutent (); |
250 | strncpy (ut->ut_id, ut_id, sizeof (ut->ut_id)); |
251 | strncpy (ut->ut_id, this->ut_id, sizeof (ut->ut_id)); |
251 | ut->ut_type = USER_PROCESS; |
252 | ut->ut_type = USER_PROCESS; |
252 | { |
253 | { |
253 | struct utmp *tmput = getutid (ut); |
254 | struct utmp *tmput = getutid (ut); |
254 | |
255 | |
255 | if (tmput) /* position to entry in utmp file */ |
256 | if (tmput) /* position to entry in utmp file */ |
… | |
… | |
266 | #endif |
267 | #endif |
267 | |
268 | |
268 | #ifdef HAVE_STRUCT_UTMPX |
269 | #ifdef HAVE_STRUCT_UTMPX |
269 | memset (utx, 0, sizeof (struct utmpx)); |
270 | memset (utx, 0, sizeof (struct utmpx)); |
270 | setutxent (); |
271 | setutxent (); |
271 | strncpy (utx->ut_id, ut_id, sizeof (utx->ut_id)); |
272 | strncpy (utx->ut_id, this->ut_id, sizeof (utx->ut_id)); |
272 | utx->ut_type = USER_PROCESS; |
273 | utx->ut_type = USER_PROCESS; |
273 | if ((tmputx = getutxid (utx))) /* position to entry in utmp file */ |
274 | if ((tmputx = getutxid (utx))) /* position to entry in utmp file */ |
274 | utx = tmputx; |
275 | utx = tmputx; |
275 | utx->ut_type = DEAD_PROCESS; |
276 | utx->ut_type = DEAD_PROCESS; |
276 | # if HAVE_UTMPX_SESSION |
277 | # if HAVE_UTMPX_SESSION |