From: nicm Date: Tue, 7 Feb 2023 10:56:04 +0000 (+0000) Subject: Remove old buffer when renaming rather than complaining, GitHub issue X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4982847631c11a0a37af4b4bc0aa990181e37663;p=openbsd Remove old buffer when renaming rather than complaining, GitHub issue 3467 from Jean-Philippe Paradis. --- diff --git a/usr.bin/tmux/paste.c b/usr.bin/tmux/paste.c index ba4e6a5da71..27f61a1b29c 100644 --- a/usr.bin/tmux/paste.c +++ b/usr.bin/tmux/paste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: paste.c,v 1.45 2022/10/28 13:00:02 nicm Exp $ */ +/* $OpenBSD: paste.c,v 1.46 2023/02/07 10:56:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -241,11 +241,8 @@ paste_rename(const char *oldname, const char *newname, char **cause) } pb_new = paste_get_name(newname); - if (pb_new != NULL) { - if (cause != NULL) - xasprintf(cause, "buffer %s already exists", newname); - return (-1); - } + if (pb_new != NULL) + paste_free(pb_new); RB_REMOVE(paste_name_tree, &paste_by_name, pb);