Revision: 2815
          http://tmux.svn.sourceforge.net/tmux/?rev=2815&view=rev
Author:   tcunha
Date:     2012-05-30 13:47:33 +0000 (Wed, 30 May 2012)
Log Message:
-----------
Sync OpenBSD patchset 1127:

Use default-shell not _PATH_BSHELL to spawn commands, pointed out by
Dennis G?nnewig and Thomas Adam.

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

Modified: trunk/window.c
===================================================================
--- trunk/window.c      2012-05-30 13:46:25 UTC (rev 2814)
+++ trunk/window.c      2012-05-30 13:47:33 UTC (rev 2815)
@@ -740,23 +740,24 @@
                clear_signals(1);
                log_close();
 
+               setenv("SHELL", wp->shell, 1);
+               ptr = strrchr(wp->shell, '/');
+
                if (*wp->cmd != '\0') {
-                       /* Set SHELL but only if it is currently not useful. */
-                       shell = getenv("SHELL");
-                       if (checkshell(shell))
-                               setenv("SHELL", wp->shell, 1);
-
-                       execl(_PATH_BSHELL, "sh", "-c", wp->cmd, (char *) NULL);
+                       /* Use the command. */
+                       if (ptr != NULL && *(ptr + 1) != '\0')
+                               xasprintf(&argv0, "%s", ptr + 1);
+                       else
+                               xasprintf(&argv0, "%s", wp->shell);
+                       execl(wp->shell, argv0, "-c", wp->cmd, (char *) NULL);
                        fatal("execl failed");
                }
 
                /* No command; fork a login shell. */
-               ptr = strrchr(wp->shell, '/');
                if (ptr != NULL && *(ptr + 1) != '\0')
                        xasprintf(&argv0, "-%s", ptr + 1);
                else
                        xasprintf(&argv0, "-%s", wp->shell);
-               setenv("SHELL", wp->shell, 1);
                execl(wp->shell, argv0, (char *) NULL);
                fatal("execl failed");
        }

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to