diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-08-11 07:45:07 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-08-11 07:45:07 +0000 |
commit | 5b097b44aaf12ae7270422a28336218ab51eff7f (patch) | |
tree | c66ea378f80d462b8ded5201eaa8f017936746d0 /usr.bin/tmux | |
parent | 12d9150ead2f3393cfa242b173a46bd8b4a3ae9e (diff) |
Do not allow duplicate session names to be created, reported by Dominik
Honnef, patch from Thomas Adam.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/cmd-rename-session.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/tmux/cmd-rename-session.c b/usr.bin/tmux/cmd-rename-session.c index 514a78b8038..d76a64e8bbb 100644 --- a/usr.bin/tmux/cmd-rename-session.c +++ b/usr.bin/tmux/cmd-rename-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-rename-session.c,v 1.5 2009/11/13 19:53:29 nicm Exp $ */ +/* $OpenBSD: cmd-rename-session.c,v 1.6 2010/08/11 07:45:06 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -45,6 +45,11 @@ cmd_rename_session_exec(struct cmd *self, struct cmd_ctx *ctx) struct cmd_target_data *data = self->data; struct session *s; + if (data->arg != NULL && session_find(data->arg) != NULL) { + ctx->error(ctx, "duplicate session: %s", data->arg); + return (-1); + } + if ((s = cmd_find_session(ctx, data->target)) == NULL) return (-1); |