Browse Source

Fix a really stupid bug with ttyname, thanks to a patch from
Stefan Soucek <ssoucek@coactive.com>

Eric Andersen 23 years ago
parent
commit
311b479b51
1 changed files with 1 additions and 1 deletions
  1. 1 1
      libc/termios/ttyname.c

+ 1 - 1
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);