Revision: 2579
          http://tmux.svn.sourceforge.net/tmux/?rev=2579&view=rev
Author:   tcunha
Date:     2011-08-21 12:35:47 +0000 (Sun, 21 Aug 2011)

Log Message:
-----------
Sync OpenBSD patchset 943:

Correctly skip existing numbers when generating the name for a new
session.

Modified Paths:
--------------
    trunk/session.c

Modified: trunk/session.c
===================================================================
--- trunk/session.c     2011-08-16 09:58:49 UTC (rev 2578)
+++ trunk/session.c     2011-08-21 12:35:47 UTC (rev 2579)
@@ -118,11 +118,18 @@
        s->sx = sx;
        s->sy = sy;
 
-       s->idx = next_session++;
-       if (name != NULL)
+       if (name != NULL) {
                s->name = xstrdup(name);
-       else
-               xasprintf(&s->name, "%u", s->idx);
+               s->idx = next_session++;
+       } else {
+               s->name = NULL;
+               do {
+                       s->idx = next_session++;
+                       if (s->name != NULL)
+                               xfree (s->name);
+                       xasprintf(&s->name, "%u", s->idx);
+               } while (RB_FIND(sessions, &sessions, s) != NULL);
+       }
        RB_INSERT(sessions, &sessions, s);
 
        if (cmd != NULL) {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to