aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2014-02-24 23:07:22 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2014-02-24 23:07:22 +0000
commit4273c1b80e2eb321d44154fe1e82e0f11aabcbd5 (patch)
treedf9829c6469655834fbf39e3ba7b03d8a86fc358 /window.c
parent488583dc8def345b32dafe5b4f9bdb0a280062d3 (diff)
downloadrtmux-4273c1b80e2eb321d44154fe1e82e0f11aabcbd5.tar.gz
rtmux-4273c1b80e2eb321d44154fe1e82e0f11aabcbd5.tar.bz2
rtmux-4273c1b80e2eb321d44154fe1e82e0f11aabcbd5.zip
Use utempter to update utmp if it's around for configure, from madmaverick9 at
roxxmail dot eu.
Diffstat (limited to 'window.c')
-rw-r--r--window.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/window.c b/window.c
index f41b58d0..70530450 100644
--- a/window.c
+++ b/window.c
@@ -779,6 +779,9 @@ window_pane_destroy(struct window_pane *wp)
evtimer_del(&wp->changes_timer);
if (wp->fd != -1) {
+#ifdef HAVE_UTEMPTER
+ utempter_remove_record(wp->fd);
+#endif
bufferevent_free(wp->event);
close(wp->fd);
}
@@ -810,6 +813,9 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
char *argv0, paneid[16];
const char *ptr;
struct termios tio2;
+#ifdef HAVE_UTEMPTER
+ char s[32];
+#endif
if (wp->fd != -1) {
bufferevent_free(wp->event);
@@ -886,6 +892,11 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
fatal("execl failed");
}
+#ifdef HAVE_UTEMPTER
+ xsnprintf(s, sizeof s, "tmux(%lu):%%%u", (long) getpid(), wp->id);
+ utempter_add_record(wp->fd, s);
+#endif
+
setblocking(wp->fd, 0);
wp->event = bufferevent_new(wp->fd,