if (len >= buflen)
if ((size_t) len >= buflen)
ttyname (int fd){  static size_t buflen;  char procname[30];  struct stat64 st, st1;  int dostat = 0;  char *name;  int save = errno;  int len;  if (!__isatty (fd))    return NULL;  /* We try using the /proc filesystem.  */  *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';  if (buflen == 0)    {      buflen = 4095;      ttyname_buf = (char *) malloc (buflen + 1);      if (ttyname_buf == NULL)	{	  buflen = 0;	  return NULL;	}    }  len = __readlink (procname, ttyname_buf, buflen);  if (len != -1      /* This is for Linux 2.0.  */      && ttyname_buf[0] != '[')    {      if (len >= buflen)	return NULL;      /* readlink need not terminate the string.  */      ttyname_buf[len] = '\0';      return ttyname_buf;    }  if (__fxstat64 (_STAT_VER, fd, &st) < 0)    return NULL;  if (__xstat64 (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))    {#ifdef _STATBUF_ST_RDEV      name = getttyname ("/dev/pts", st.st_rdev, st.st_ino, save, &dostat);#else      name = getttyname ("/dev/pts", st.st_dev, st.st_ino, save, &dostat);#endif    }  else    {      __set_errno (save);      name = NULL;    }  if (!name && dostat != -1)    {#ifdef _STATBUF_ST_RDEV      name = getttyname ("/dev", st.st_rdev, st.st_ino, save, &dostat);#else      name = getttyname ("/dev", st.st_dev, st.st_ino, save, &dostat);#endif    }  if (!name && dostat != -1)    {      dostat = 1;#ifdef _STATBUF_ST_RDEV      name = getttyname ("/dev", st.st_rdev, st.st_ino, save, &dostat);#else      name = getttyname ("/dev", st.st_dev, st.st_ino, save, &dostat);#endif    }  return name;}