pike.git / src / modules / _Stdio / file.c

version» Context lines:

pike.git/src/modules/_Stdio/file.c:2718: Inside #if undefined(HAVE_UNLOCKPT)
     #ifndef HAVE_UNLOCKPT   #define HAVE_UNLOCKPT   #define unlockpt(m) 0   #endif      #if !defined(HAVE_OPENPTY) && defined(HAVE_PTSNAME) && defined(HAVE_POSIX_OPENPT)   static int my_openpty(int *master, int *slave, void *ignored_name,    void *ignored_termp, void *ignored_winp)   { -  int m = posix_openpt(O_RDWR | O_NOCTTY); +  int m;    int s;    char *sname; -  +  if (!master || !slave) { +  errno = EINVAL; +  return -1; +  } +  m = posix_openpt(O_RDWR | O_NOCTTY);    if (m < 0) return -1; -  if (grantpt(m) && unlockpt(m) && (sname = ptsname(m))) { +  if (!grantpt(m) && !unlockpt(m) && (sname = ptsname(m))) {    int s = open(sname, O_RDWR | O_NOCTTY);    if (s >= 0) { -  if (master) *master = m; -  if (slave) *slave = s; +  *master = m; +  *slave = s;   #ifdef I_PUSH    /* Push required STREAMS modules.    * cf pts(4D)/pts(7D) on Solaris.    *    * Not required on Solaris 11.4 and later.    */    ioctl(s, I_PUSH, "ptem"); /* Pseudo terminal emulation mode */    ioctl(s, I_PUSH, "ldterm"); /* Terminal line discipline */    ioctl(s, I_PUSH, "ttcompat"); /* BSD terminal compatibility */   #endif