2010-03-11 Ken Peters <kptrs@yahoo.com>

PR 1456/cpukit
	* libcsupport/src/ttyname.c: ttyname_r() when called directly (not via
	ttyname()) does not prefix the caller provided buffer with the
	predefined _PATH_DEV string (/dev/). Thus the directory search fails
	and no tty name is returned to the caller.
This commit is contained in:
Joel Sherrill
2010-03-11 19:14:41 +00:00
parent 8c8e3e0977
commit e137f0e944
2 changed files with 12 additions and 1 deletions

View File

@@ -1,3 +1,11 @@
2010-03-11 Ken Peters <kptrs@yahoo.com>
PR 1456/cpukit
* libcsupport/src/ttyname.c: ttyname_r() when called directly (not via
ttyname()) does not prefix the caller provided buffer with the
predefined _PATH_DEV string (/dev/). Thus the directory search fails
and no tty name is returned to the caller.
2010-03-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* ftpd/ftpd.c, httpd/uemf.c, httpd/um.c, httpd/webs.c,

View File

@@ -55,7 +55,7 @@
#include <rtems/libio_.h>
#include <rtems/seterr.h>
static char ttyname_buf[sizeof (_PATH_DEV) + MAXNAMLEN] = _PATH_DEV;
static char ttyname_buf[sizeof (_PATH_DEV) + MAXNAMLEN];
/*
* ttyname_r() - POSIX 1003.1b 4.7.2 - Demetermine Terminal Device Name
@@ -84,6 +84,9 @@ int ttyname_r(
if ((dp = opendir (_PATH_DEV)) == NULL)
rtems_set_errno_and_return_minus_one(EBADF);
/* Place the base directory in the path. */
strncpy (name, _PATH_DEV, namesize);
for (rval = NULL; (dirp = readdir (dp)) != NULL ;)
{
if (dirp->d_ino != sb.st_ino)