summaryrefslogtreecommitdiffstats
path: root/session.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-12-22 15:28:51 +0000
committerTiago Cunha <tcunha@gmx.com>2010-12-22 15:28:51 +0000
commit64d16cf2d67c42642401cd0bbaeb278a1c00822a (patch)
tree1c46fd6b97b50bea12f67f0602ce5c149dbf1c1e /session.c
parentb8eae3902b8586a575138289f9157a3dac46f92c (diff)
Sync OpenBSD patchset 801:
Unify the way sessions are used by callbacks - store the address and use the reference count, then check it is still on the global sessions list in the callback.
Diffstat (limited to 'session.c')
-rw-r--r--session.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/session.c b/session.c
index 1cd2d584..f061d18f 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $Id: session.c,v 1.78 2010-09-10 13:36:17 tcunha Exp $ */
+/* $Id: session.c,v 1.79 2010-12-22 15:28:50 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,6 +34,18 @@ struct session_groups session_groups;
struct winlink *session_next_alert(struct winlink *);
struct winlink *session_previous_alert(struct winlink *);
+/*
+ * Find if session is still alive. This is true if it is still on the global
+ * sessions list.
+ */
+int
+session_alive(struct session *s)
+{
+ u_int idx;
+
+ return (session_index(s, &idx) == 0);
+}
+
/* Find session by name. */
struct session *
session_find(const char *name)