mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 18:38:48 +00:00
Don't allow multiple buffers with the same name, from Thomas Adam.
This commit is contained in:
parent
b3e8d440ed
commit
b2e791b574
11
paste.c
11
paste.c
@ -176,7 +176,7 @@ paste_add(char *data, size_t size)
|
||||
int
|
||||
paste_rename(const char *oldname, const char *newname, char **cause)
|
||||
{
|
||||
struct paste_buffer *pb;
|
||||
struct paste_buffer *pb, *pb_new;
|
||||
|
||||
if (cause != NULL)
|
||||
*cause = NULL;
|
||||
@ -195,7 +195,14 @@ paste_rename(const char *oldname, const char *newname, char **cause)
|
||||
pb = paste_get_name(oldname);
|
||||
if (pb == NULL) {
|
||||
if (cause != NULL)
|
||||
xasprintf(cause, "no buffer %s", oldname);
|
||||
xasprintf(cause, "no buffer %s", oldname);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
pb_new = paste_get_name(newname);
|
||||
if (pb_new != NULL) {
|
||||
if (cause != NULL)
|
||||
xasprintf(cause, "buffer %s already exists", newname);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user