Branch: Tag:

2020-02-07

2020-02-07 12:17:35 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Make Coverity happy. [CID 1457890]

2568: Inside #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))) {    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.