The branch, master has been updated
via e9b09faab262f179fec936c4036713866b98e3d0 (commit)
from 5ea6148362e6f80019b0f41c29bdc395c69e41dc (commit)
- Log -----------------------------------------------------------------
commit e9b09faab262f179fec936c4036713866b98e3d0
Author: Nicholas Marriott <[email protected]>
Commit: Nicholas Marriott <[email protected]>
We accidentally haven't been using $TMUX to work out the session for a while
and in fact it is less useful that using the client ttyname. So don't bother
and don't pass it from the client. If we need it in future it is in
c->environ.
---
client.c | 4 ----
cmd.c | 8 --------
server-client.c | 2 ++
tmux.c | 30 ++++++++----------------------
tmux.h | 7 -------
5 files changed, 10 insertions(+), 41 deletions(-)
diff --git a/client.c b/client.c
index 8884f63..d1a3b17 100644
--- a/client.c
+++ b/client.c
@@ -284,10 +284,6 @@ client_main(int argc, char **argv, int flags)
size += strlen(argv[i]) + 1;
data = xmalloc((sizeof *data) + size);
- /* Fill in command line arguments. */
- data->pid = environ_pid;
- data->session_id = environ_session_id;
-
/* Prepare command for server. */
data->argc = argc;
if (cmd_pack_argv(argc, argv, (char*)(data + 1), size) != 0) {
diff --git a/cmd.c b/cmd.c
index 9075695..414c906 100644
--- a/cmd.c
+++ b/cmd.c
@@ -313,7 +313,6 @@ cmd_print(struct cmd *cmd, char *buf, size_t len)
struct session *
cmd_current_session(struct cmd_q *cmdq, int prefer_unattached)
{
- struct msg_command_data *data = cmdq->msgdata;
struct client *c = cmdq->client;
struct session *s;
struct sessionslist ss;
@@ -355,13 +354,6 @@ cmd_current_session(struct cmd_q *cmdq, int
prefer_unattached)
return (s);
}
- /* Use the session from the TMUX environment variable. */
- if (data != NULL && data->pid == getpid() && data->session_id != -1) {
- s = session_find_by_id(data->session_id);
- if (s != NULL)
- return (s);
- }
-
return (cmd_choose_session(prefer_unattached));
}
diff --git a/server-client.c b/server-client.c
index 090916c..aceef6e 100644
--- a/server-client.c
+++ b/server-client.c
@@ -62,6 +62,8 @@ server_client_create(int fd)
fatal("gettimeofday failed");
memcpy(&c->activity_time, &c->creation_time, sizeof c->activity_time);
+ environ_init(&c->environ);
+
c->cmdq = cmdq_new(c);
c->cmdq->client_exit = 1;
diff --git a/tmux.c b/tmux.c
index a035996..1e6edd9 100644
--- a/tmux.c
+++ b/tmux.c
@@ -48,11 +48,8 @@ time_t start_time;
char socket_path[MAXPATHLEN];
int login_shell;
char *environ_path;
-pid_t environ_pid = -1;
-int environ_session_id = -1;
__dead void usage(void);
-void parseenvironment(void);
char *makesocketpath(const char *);
#ifndef HAVE___PROGNAME
@@ -127,23 +124,6 @@ areshell(const char *shell)
return (0);
}
-void
-parseenvironment(void)
-{
- char *env, path[256];
- long pid;
- int id;
-
- if ((env = getenv("TMUX")) == NULL)
- return;
-
- if (sscanf(env, "%255[^,],%ld,%d", path, &pid, &id) != 3)
- return;
- environ_path = xstrdup(path);
- environ_pid = pid;
- environ_session_id = id;
-}
-
char *
makesocketpath(const char *label)
{
@@ -226,7 +206,9 @@ main(int argc, char **argv)
{
struct passwd *pw;
char *s, *path, *label, *home, **var, tmp[MAXPATHLEN];
- int opt, flags, quiet, keys;
+ char in[256];
+ long long pid;
+ int opt, flags, quiet, keys, session;
#if defined(DEBUG) && defined(__OpenBSD__)
malloc_options = (char *) "AFGJPX";
@@ -357,11 +339,15 @@ main(int argc, char **argv)
}
}
+ /* Get path from environment. */
+ s = getenv("TMUX");
+ if (s != NULL && sscanf(s, "%255[^,],%lld,%d", in, &pid, &session) == 3)
+ environ_path = xstrdup(in);
+
/*
* Figure out the socket path. If specified on the command-line with -S
* or -L, use it, otherwise try $TMUX or assume -L default.
*/
- parseenvironment();
if (path == NULL) {
/* If no -L, use the environment. */
if (label == NULL) {
diff --git a/tmux.h b/tmux.h
index a76d102..84ad164 100644
--- a/tmux.h
+++ b/tmux.h
@@ -457,9 +457,6 @@ enum msgtype {
* Don't forget to bump PROTOCOL_VERSION if any of these change!
*/
struct msg_command_data {
- pid_t pid; /* from $TMUX or -1 */
- int session_id; /* from $TMUX or -1 */
-
int argc;
}; /* followed by packed argv */
@@ -1401,8 +1398,6 @@ struct cmd_q {
void (*emptyfn)(struct cmd_q *);
void *data;
- struct msg_command_data *msgdata;
-
TAILQ_ENTRY(cmd_q) waitentry;
};
@@ -1496,8 +1491,6 @@ extern time_t start_time;
extern char socket_path[MAXPATHLEN];
extern int login_shell;
extern char *environ_path;
-extern pid_t environ_pid;
-extern int environ_session_id;
void logfile(const char *);
const char *getshell(void);
int checkshell(const char *);
-----------------------------------------------------------------------
Summary of changes:
client.c | 4 ----
cmd.c | 8 --------
server-client.c | 2 ++
tmux.c | 30 ++++++++----------------------
tmux.h | 7 -------
5 files changed, 10 insertions(+), 41 deletions(-)
hooks/post-receive
--
tmux
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs