/* Determine name of the slave side of a pseudo-terminal.
- Copyright (C) 1998, 2002, 2010-2012 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2010-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
ret = ioctl (fd, ISPTM, NULL);
dev = ret;
# endif
- if (dev < 0)
+ if (ret < 0)
{
errno = ENOTTY;
return errno;
return errno;
}
- buf[sizeof (_PATH_DEV) - 1] = 't';
+ if (strncmp(buf, "/dev/pts/", strlen("/dev/pts/")) != 0)
+ buf[sizeof (_PATH_DEV) - 1] = 't';
#endif
if (__stat (buf, &st) < 0)