Commit Graph

112 Commits

Author SHA1 Message Date
nicm
1b31d148c9 Remove some dead code in cmd-move-window.c and make a load of local
functions static.
2016-10-03 22:52:11 +00:00
nicm
995af0e2b7 I no longer use my SourceForge address so replace it. 2016-01-19 15:59:12 +00:00
nicm
ac8678aefe Don't print error if none to print. 2015-11-25 07:58:55 +00:00
nicm
3ff46b2e43 Shell command from -c doesn't have to be global, pass it as an argument. 2015-11-24 23:22:51 +00:00
nicm
dca93c56e0 Do lock failures slightly better, return a special value so we don't
unlink the wrong thing.
2015-11-24 23:01:51 +00:00
nicm
73e30cbda8 Actually show something (even if it not that helpful) if the server
fails to start (for example if it can't create the socket), rather than
hanging or showing nothing.
2015-11-24 22:45:44 +00:00
nicm
c913fb99b6 Tidy the code that works out the socket path, and just use the full path
in the global socket_path rather than copying it.
2015-11-24 22:27:22 +00:00
nicm
bef217b241 Switch a fprintf to a fatal, and wrap some long lines. 2015-11-24 22:04:36 +00:00
nicm
577c0e3e5a Use __unused rather than rolling our own. 2015-11-18 14:27:44 +00:00
nicm
a582b62287 Accidentally turned off pledge, turn it back on. 2015-11-15 14:32:48 +00:00
nicm
c56b81a2ce Push stdout and stderr to clients more aggressively, and add an event to
continue if the send fails.
2015-11-14 09:41:06 +00:00
nicm
b0a99e85b6 Don't shift version out of peerid, it is needed later. 2015-10-31 13:43:38 +00:00
nicm
01defc9f49 Because pledge(2) does not allow us to pass directory file descriptors
around, we can't use file descriptors for the working directory because
we will be unable to pass it to a privileged process to tell it where to
read or write files or spawn children. So move tmux back to using
strings for the current working directory. We try to check it exists
with access() when it is set but ultimately fall back to ~ if it fails
at time of use (or / if that fails too).
2015-10-31 08:13:58 +00:00
nicm
bf9c933cae Like options, move the environ struct into environ.c. 2015-10-28 09:51:55 +00:00
nicm
44657bf932 Move struct options into options.c. 2015-10-27 15:58:42 +00:00
nicm
07b0ea03c3 Break the common process set up, event loop and imsg dispatch code
between server and client out into a separate internal API. This will
make it easier to add another process.
2015-10-27 13:23:24 +00:00
nicm
174a2ad731 Pass current directory as a string rather than a file descriptor because
pledge doesn't let us pass directory file descriptors.
2015-10-18 20:42:42 +00:00
nicm
9c601ebde8 Add pledge "stdio unix sendfd proc exec tty" to tmux client process,
"sendfd" is dropped after first message from the server.
2015-10-17 18:30:43 +00:00
guenther
241fd72f75 Userspace doesn't need to use SUN_LEN(): connect() and bind() must accept
sizeof(struct sockaddr_un), so do the simple, portable thing

ok beck@ deraadt@
2015-10-11 00:26:23 +00:00
nicm
2a62917444 Don't leak fd and path on failure. 2015-09-24 12:06:20 +00:00
nicm
67ee995cc1 No need to keep global options around for client which doesn't use them. 2015-09-09 12:09:21 +00:00
nicm
c6e9160c67 Login shell can be a client flag, and move the exec code into client.c. 2015-08-30 22:40:25 +00:00
nicm
dd92b6e83d Event base does not need to be global. 2015-08-30 22:19:07 +00:00
nicm
4e637b1b61 Ignore environment variables that are too long to send to the server. 2015-07-13 18:10:26 +00:00
nicm
29c29e7717 Add a format for client PID (client_pid) and server PID (pid). Diff for
client_pid from Thomas Adam.
2015-06-14 10:07:44 +00:00
nicm
6b2129696f Move the nested check from client to server and compare the client tty
name to all the pane pty names instead of comparing socket paths. This
means that "new -d" will work without unsetting $TMUX.
2015-06-04 23:27:51 +00:00
nicm
a5a873dccc Set up signal handler earlier so that we don't get zombies, reported by
sobrado@.
2015-04-24 20:58:44 +00:00
nicm
7a72eff4a4 Simplify error messages when socket connect fails, suggested by "Karthik K". 2015-04-21 22:21:41 +00:00
nicm
02df86079b Fix some format specifier nits, from Ben Boeckel. 2015-03-31 17:45:10 +00:00
nicm
900f6fc17e Tidy up some includes. 2014-10-20 23:27:14 +00:00
nicm
045d0c3b9f Call waitpid on SIGCHLD even if client not attached, it is possible (on
very slow platforms) for the first daemon() child to still be running
when client_attached is set so we end up with a zombie. From J Raynor.
2014-10-01 23:23:19 +00:00
nicm
4e956d545a Various minor style and spacing nits. 2014-09-01 21:50:18 +00:00
nicm
8e4ae12b4d lockf is entirely useless and it was a mistake to change to it, go back
to using flock which actually works sensibly. Also always retry the lock
to fix a potential race, and add some extra logging.
2014-07-21 10:52:48 +00:00
krw
2b67907176 An EOF is a good reason to close a connection.
ok nicm@
2014-07-13 20:51:08 +00:00
nicm
5b2c8156d5 fcntl.h is still needed here. 2014-04-29 22:31:22 +00:00
nicm
bce952777a Remove some unnecessary includes and fix a typo. 2014-04-17 11:38:35 +00:00
nicm
b185449d07 Fix a memory/fd leak reported by Tiago Cunha. 2014-01-09 21:20:45 +00:00
nicm
adc1f21eae Three small changes from Tiago Cunha:
- Check for truncation when copying path.
- Don't need to use a temporary buffer in screen_set_title.
- Include strerror in output when connecting to server fails.
2014-01-09 14:05:55 +00:00
benno
7624800ddc from nicm: : handle msgbuf_write() returning EAGAIN 2013-11-13 20:43:36 +00:00
nicm
99e3cbc526 Use format_get_command() and some spacing tweaks. 2013-10-10 12:35:30 +00:00
nicm
c1ccefc62d 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.
2013-10-10 12:29:35 +00:00
nicm
7936ce3874 Show session name in detached message. Requested by somebody a few
months ago who didn't bother testing it. But it works for me anyway.
2013-10-10 12:28:08 +00:00
nicm
b8b85fbb0c Don't look at string[length - 1] if length == 0. 2013-10-10 12:27:38 +00:00
nicm
282c5f9644 Alter how tmux handles the working directory to internally use file
descriptors rather than strings.

- Each session still has a current working directory.

- New sessions still get their working directory from the client that
  created them or its attached session if any.

- New windows are created by default in the session working directory.

- The -c flag to new, neww, splitw allows the working directory to be
  overridden.

- The -c flag to attach let's the session working directory be changed.

- The default-path option has been removed.

To get the equivalent to default-path '.', do:

        bind c neww -c $PWD

To get the equivalent of default-path '~', do:

        bind c neww -c ~

This also changes the client identify protocol to be a set of messages rather
than one as well as some other changes that should make it easier to make
backwards-compatible protocol changes in future.
2013-10-10 12:26:34 +00:00
nicm
10c38436aa Similarly for MSG_COMMAND - allow full imsg limit not arbitrary 2048. 2013-10-10 12:13:56 +00:00
nicm
6c093010e0 Remove CMD_SENDENVIRON. 2013-10-10 12:09:34 +00:00
Nicholas Marriott
d89b35e682 Use lockf which is more portable than flock, from Dagobert Michelsen. 2013-04-22 08:42:19 +00:00
Nicholas Marriott
88b92df849 We ignore SIGWINCH until ready, so send a MSG_RESIZE immediately when
becoming ready.
2013-03-25 11:38:57 +00:00
Nicholas Marriott
6fee3e9e4b Rename session idx to session id throughout and add $ prefix to targets
to use it, extended from a diff from George Nachman.
2013-03-25 10:11:45 +00:00
Nicholas Marriott
62db3c8efe Send DSC 1000p at the beginning of a -CC client's lifetime and ST and
the end, from George Nachman.
2013-03-25 10:03:24 +00:00