summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2016-11-16 11:41:18 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2016-11-16 11:41:18 +0000
commit45821c8809d2814c3fa617c96933b9c978daa37a (patch)
tree6da469d9853887e06f6ff42ae5b2b23e7f7a8243 /usr.bin/tmux
parentb67bc5de62334f8368ed0239afeca0bfc05eab61 (diff)
Don't error if renaming a session to its current name, from shik dot
chen at gmail dot com.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/cmd-rename-session.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/tmux/cmd-rename-session.c b/usr.bin/tmux/cmd-rename-session.c
index 89f213f5757..9d5a2eb360e 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.24 2016/10/16 22:06:40 nicm Exp $ */
+/* $OpenBSD: cmd-rename-session.c,v 1.25 2016/11/16 11:41:17 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <stdlib.h>
+#include <string.h>
#include "tmux.h"
@@ -50,6 +51,9 @@ cmd_rename_session_exec(struct cmd *self, struct cmdq_item *item)
const char *newname;
newname = args->argv[0];
+ if (strcmp(newname, s->name) == 0)
+ return (CMD_RETURN_NORMAL);
+
if (!session_check_name(newname)) {
cmdq_error(item, "bad session name: %s", newname);
return (CMD_RETURN_ERROR);