Whoops, applied, thanks.
On Tue, May 13, 2014 at 10:55:58PM +0100, Thomas Adam wrote:
> With the recent ability to name paste buffers, the following is possible:
>
> % ~/projects/tmux/tmux setb -b buffer0001 -nfoo
> % ~/projects/tmux/tmux setb -b buffer0000 -nbuffer0001
> % ~/projects/tmux/tmux setb -b foo -nbuffer0001
>
> Which results in two paste buffers with the same name. Perfectly legal
> since they're two different paste buffers, but it's confusing as hell
> working out which one of those gets used.
>
> So check for this, and disallow it.
> ---
> paste.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/paste.c b/paste.c
> index fdd4f5d..e6f77c4 100644
> --- a/paste.c
> +++ b/paste.c
> @@ -175,7 +175,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;
> @@ -192,12 +192,22 @@ paste_rename(const char *oldname, const char *newname,
> char **cause)
> }
>
> pb = paste_get_name(oldname);
> + pb_new = paste_get_name(newname);
> +
> if (pb == NULL) {
> if (cause != NULL)
> xasprintf(cause, "no buffer %s", oldname);
> return (-1);
> }
>
> + if (pb_new != NULL) {
> + if (cause != NULL) {
> + xasprintf(cause,
> + "buffer '%s' already exists", newname);
> + }
> + return (-1);
> + }
> +
> RB_REMOVE(paste_name_tree, &paste_by_name, pb);
>
> free(pb->name);
> --
> 1.8.4.rc2
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.
> Get unparalleled scalability from the best Selenium testing platform available
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> tmux-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users