/* Determine name of the slave side of a pseudo-terminal.
- Copyright (C) 1998, 2002, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2010-2011 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
/* Static buffer for `ptsname'. */
-static char buffer[sizeof (_PATH_TTY) + 2];
+static char buffer[64];
/* Return the pathname of the pseudo terminal slave associated with
__ptsname_r (int fd, char *buf, size_t buflen)
{
int save_errno = errno;
+ int err;
struct stat st;
if (buf == NULL)
return ERANGE;
}
- if (__ttyname_r (fd, buf, buflen) != 0)
- return errno;
+ err = __ttyname_r (fd, buf, buflen);
+ if (err != 0)
+ {
+ __set_errno (err);
+ return errno;
+ }
buf[sizeof (_PATH_DEV) - 1] = 't';