pty: Factor out common code
pty: Factor out common code

Both BSD openpty() opened and foreign FD cases need all three of these
calls, so factor them out into a separate function.

saitoha/vte-sixel,saitoha/vte-sixel,saitoha/vte-sixel,thestinger/vte-ng,thestinger/vte-ng,thestinger/vte-ng