summaryrefslogtreecommitdiffstats
path: root/paste.c
diff options
context:
space:
mode:
authornicm <nicm>2023-02-07 10:56:04 +0000
committernicm <nicm>2023-02-07 10:56:04 +0000
commit1262e685b827a155d68e92f44077bfd1d44f1812 (patch)
tree4f5e9ba5d6b07b382a348cf8713e91a2dc0804a8 /paste.c
parent0bd78b42c0a379e46645a7083e0b4785b19e39aa (diff)
Remove old buffer when renaming rather than complaining, GitHub issue
3467 from Jean-Philippe Paradis.
Diffstat (limited to 'paste.c')
-rw-r--r--paste.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/paste.c b/paste.c
index 7565c207..ba9dd46b 100644
--- a/paste.c
+++ b/paste.c
@@ -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);