summaryrefslogtreecommitdiffstats
path: root/cmd-new-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2011-04-06 22:29:26 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2011-04-06 22:29:26 +0000
commite5f4bf3f3ec206bedf0f4a04b8158cff8c734f11 (patch)
treebc143973bb375f5176d41a00384d7cab9bbb944d /cmd-new-session.c
parent13c54a04a0ef236dd2df36ca3fa5fd1b89272be6 (diff)
|PatchSet 884
|Date: 2011/04/06 22:51:31 |Author: nicm |Branch: HEAD |Tag: (none) |Log: |Change so that an empty session name always means the current sessions |even if given with, for example, -t '', and explicitly forbid empty |session names and those containing a : when they are created.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r--cmd-new-session.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 175a3d41..18fffa1b 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-session.c,v 1.85 2011-04-06 22:24:00 nicm Exp $ */
+/* $Id: cmd-new-session.c,v 1.86 2011-04-06 22:29:26 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -68,9 +68,15 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
u_int sx, sy, i;
newname = args_get(args, 's');
- if (newname != NULL && session_find(newname) != NULL) {
- ctx->error(ctx, "duplicate session: %s", newname);
- return (-1);
+ if (newname != NULL) {
+ if (!session_check_name(newname)) {
+ ctx->error(ctx, "bad session name: %s", newname);
+ return (-1);
+ }
+ if (session_find(newname) != NULL) {
+ ctx->error(ctx, "duplicate session: %s", newname);
+ return (-1);
+ }
}
target = args_get(args, 't');