Remove XXX comment and just close received fd if calloc() fails.
If this happens the imsg may no longer be usable as there may be queued
messages, but this is a) already the case with the code now, and b)
would be the case if recvmsg() fails anyway, so we can document that -1
from imsg_read() invalidates the struct imsgbuf.
discussed with and ok eric
==
Rather than constructing an entire termios struct from ttydefaults.h, just let
forkpty do it and then alter the bits that should be changed after fork. A
little neater and more portable.
==
This should fix problems caused by glibc's broken ttydefaults.h file.
Enclose repeated buffer draining code in a new msgbuf_drain()
function, which is additionally exported for use by others.
From nicm@, who reminded me that tmux is now using buffer.c, too.
Switch tmux to use imsg. This is the last major change to make the
client-server protocol more resilient and make the protocol versioning work
properly. In future, the only things requiring a protocol version bump will be
changes in the message structs, and (when both client and server have this
change) mixing different versions should nicely report an error message.
As a side effect this also makes the code tidier, fixes a problem with the way
errors reported during server startup were handled, and supports fd passing
(which will be used in future).
Looked over by eric@, thanks.
Please note that mixing a client with this change with an older server or vice
versa may cause tmux to crash or hang - tmux should be completely exited before
upgrading.
script which must be run before building.
Still two makefiles but they are a hell of a lot simpler.
HAVE_* also will make it easier to move to $buildsystem if necessary later.