return tty;
}
- /* Check for ttyACMx style names
+ /* Check for tty/ttyACMx style names
*/
- ntty = scandir(endpoint_full, &namelist,
+ tty_dir = cc_fullname(endpoint_full, "tty");
+ ntty = scandir(tty_dir, &namelist,
dir_filter_tty,
alphasort);
+ free (tty_dir);
if (ntty > 0) {
- free(endpoint_full);
tty = cc_fullname("/dev", namelist[0]->d_name);
+ free(endpoint_full);
free(namelist);
return tty;
}
- /* Check for tty/ttyACMx style names
+ /* Check for ttyACMx style names
*/
- tty_dir = cc_fullname(endpoint_full, "tty");
- free(endpoint_full);
- ntty = scandir(tty_dir, &namelist,
+ ntty = scandir(endpoint_full, &namelist,
dir_filter_tty,
alphasort);
- free (tty_dir);
+ free(endpoint_full);
if (ntty > 0) {
tty = cc_fullname("/dev", namelist[0]->d_name);
free(namelist);