Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv22818

Modified Files:
        server.c 
Log Message:
Sync OpenBSD patchset 765:

Modify the permissions on the socket when adding or removing +x to show
attached sessions, rather than replacing them.


Index: server.c
===================================================================
RCS file: /cvsroot/tmux/tmux/server.c,v
retrieving revision 1.243
retrieving revision 1.244
diff -u -d -r1.243 -r1.244
--- server.c    29 Aug 2010 14:42:11 -0000      1.243
+++ server.c    9 Oct 2010 14:26:29 -0000       1.244
@@ -300,7 +300,8 @@
        struct session  *s;
        u_int            i;
        static int       last = -1;
-       int              n;
+       int              n, mode;
+       struct stat      sb;
 
        n = 0;
        for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
@@ -313,10 +314,20 @@
 
        if (n != last) {
                last = n;
-               if (n != 0)
-                       chmod(socket_path, S_IRWXU|S_IRWXG);
-               else
-                       chmod(socket_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
+
+               if (stat(socket_path, &sb) != 0)
+                       return;
+               mode = sb.st_mode;
+               if (n != 0) {
+                       if (mode & S_IRUSR)
+                               mode |= S_IXUSR;
+                       if (mode & S_IRGRP)
+                               mode |= S_IXGRP;
+                       if (mode & S_IROTH)
+                               mode |= S_IXOTH;
+               } else
+                       mode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
+               chmod(socket_path, mode);
        }
 }
 


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to