On Thu, Sep 14, 2017 at 3:11 PM, Laurent Bercot
wrote:
>
>
> It is a POSIX requirement that command-line programs are run with
> 0, 1 and 2 open.
Ah, the standard that gave us the "not counting leap seconds" pearl!
I wouldn't guess the requirement would be that general.
> Nevertheless, faili
(As in: is
it a general assumption that a service must inherit the usual 3 file
descriptors?)
It is a POSIX requirement that command-line programs are run with
0, 1 and 2 open.
Nevertheless, failing to address that requirement should not cause
malfunction in a program, so yes, it is a tcpserv
tcpserver has no use for stdin, so it closes fd 0, but does it too late:
(tcpserver.c)
line 369: s = socket_tcp();
line 394: close(0);
This closes s when the program is launched with fd 0 closed. Nothing
in the documentation suggests that closing stdin before launching a
tcpserver based service