Now, reading the code it seems to me that p->subtty is unconditionally
set to Qnil when the fork of the subprocess succeeds, so the first
ioctl will never be executed.
Here's the code that sets subtty.
/* Record the tty descriptor used in the subprocess. */
if (forkin < 0)
XPROCESS (process)->subtty = Qnil;
else
XSETFASTINT (XPROCESS (process)->subtty, forkin);
It doesn't look like this always sets it to nil, unless
forkin is always < 0. Basically, it is not SUPPOSED
to be always nil, so if you find that it always IS nil,
there must be a bug somewhere.