https://gitlab.synchro.net/main/sbbs/-/commit/92c2fd33bdff650976b48e11
Modified Files:
src/doors/syncdoom/syncdoom.c
Log Message:
syncdoom: on a tty, VMIN=0 makes "no input" indistinguishable from EOF
The *nix stdio path put the terminal in raw mode with VMIN=0/VTIME=0 and
relied on O_NONBLOCK to report an empty read as -1/EAGAIN. A tty does not
work that way: with VMIN and VTIME both zero the read timeout is zero, and
the kernel returns 0 before it ever consults O_NONBLOCK. conn_read() maps 0
to EOF, so the first input pump with nobody mid-keystroke set g_hangup and
the door exited with status 0 on its very first frame -- immediately after "ST_Init: Init status bar.", and with no diagnostic.
VMIN=1 restores the distinction conn_read() depends on: -1/EAGAIN when no
byte is waiting, 0 only when the client really has gone. O_NONBLOCK is what keeps the read from blocking.
This left stdio mode unusable on every *nix host, whether the door was
started from a shell or handed its stdio by a BBS. The path had only ever
been exercised over pipes, where tcgetattr() fails, the termios block is skipped, and 0 does mean EOF. A BBS gives a stdio door a pty, so the door applied VMIN=0 there as well -- overriding, under Synchronet's XTRN_STDIO,
the cfmakeraw() the BBS had just done.
Socket doors are unaffected: raw_input_on() returns early on one.
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net