Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2005-07-07 21:29:13 +0400
committerJeff Johnston <jjohnstn@redhat.com>2005-07-07 21:29:13 +0400
commitb32adfc5cfadfa03f49ae79dac8d45fa8887bed3 (patch)
tree09ab41a9fc52a3da9f235dad126f65c99083fcf0 /newlib/libc/unix
parent469b489504468677218aca3b0df9278c36cfeea4 (diff)
*** empty log message ***
Diffstat (limited to 'newlib/libc/unix')
-rw-r--r--newlib/libc/unix/ttyname.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/newlib/libc/unix/ttyname.c b/newlib/libc/unix/ttyname.c
index 258ba25fe..558f70939 100644
--- a/newlib/libc/unix/ttyname.c
+++ b/newlib/libc/unix/ttyname.c
@@ -56,7 +56,6 @@ ttyname (fd)
struct dirent *dirp;
DIR *dp;
struct stat dsb;
- char *rval;
/* Must be a terminal. */
if (tcgetattr (fd, &tty) < 0)
@@ -69,7 +68,7 @@ ttyname (fd)
if ((dp = _opendir (_PATH_DEV)) == NULL)
return NULL;
- for (rval = NULL; dirp = _readdir (dp);)
+ while ((dirp = _readdir (dp)) != NULL)
{
if (dirp->d_ino != sb.st_ino)
continue;
@@ -78,9 +77,8 @@ ttyname (fd)
sb.st_ino != dsb.st_ino)
continue;
(void) _closedir (dp);
- rval = buf;
- break;
+ return buf;
}
(void) _closedir (dp);
- return rval;
+ return NULL;
}