summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/termios/ttyname.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/termios/ttyname.c b/libc/termios/ttyname.c
index f7f066e61..e6c28adc2 100644
--- a/libc/termios/ttyname.c
+++ b/libc/termios/ttyname.c
@@ -18,7 +18,7 @@ static char * __check_dir_for_tty_match(char * dirname, struct stat *st)
strcat(name, "/");
while ((d = readdir(fp)) != 0) {
- strcpy(name + sizeof(dirname), d->d_name);
+ strcpy(name + strlen(dirname) + 1, d->d_name);
if (stat(name, &dst) == 0
&& st->st_dev == dst.st_dev && st->st_ino == dst.st_ino) {
closedir(fp);