aboutsummaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-10-03 21:31:07 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-10-03 21:31:07 +0000
commitdf716ecc8fadc9ffd6b8c9ee33d062b58895a47b (patch)
treed9ba914e38d207a7ed1ee330cdc48bc681b220fe /session.c
parenta5a17b40ee9cd25eae3c3d177abf4e4faa2dc4d8 (diff)
downloadrtmux-df716ecc8fadc9ffd6b8c9ee33d062b58895a47b.tar.gz
rtmux-df716ecc8fadc9ffd6b8c9ee33d062b58895a47b.tar.bz2
rtmux-df716ecc8fadc9ffd6b8c9ee33d062b58895a47b.zip
Rewrite command handling to be more generic. Not finished!
Diffstat (limited to 'session.c')
-rw-r--r--session.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/session.c b/session.c
index a12f715e..69b528ed 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $Id: session.c,v 1.19 2007-09-29 21:02:26 nicm Exp $ */
+/* $Id: session.c,v 1.20 2007-10-03 21:31:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -64,11 +64,10 @@ session_create(const char *name, const char *cmd, u_int sx, u_int sy)
if (i == ARRAY_LENGTH(&sessions))
ARRAY_ADD(&sessions, s);
- if (*name != '\0')
- strlcpy(s->name, name, sizeof s->name);
+ if (name != NULL)
+ s->name = xstrdup(name);
else
- xsnprintf(s->name, sizeof s->name, "%u", i);
-
+ xasprintf(&s->name, "%u", i);
if (session_new(s, cmd, sx, sy) != 0) {
session_destroy(s);
return (NULL);
@@ -92,6 +91,7 @@ session_destroy(struct session *s)
while (!ARRAY_EMPTY(&s->windows))
window_remove(&s->windows, ARRAY_FIRST(&s->windows));
+ xfree(s->name);
xfree(s);
}