diff options
| author | Keith Packard <keithp@keithp.com> | 2013-01-10 21:26:20 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2013-01-10 21:48:31 -0800 | 
| commit | 12a9bd0479db25cbe45c0385913315cc1e0bc892 (patch) | |
| tree | 51246d87f594c1a397d8e6718ad73e47db8eaa32 | |
| parent | 1ed6b13e87c1cc2d6618b6ba3a293ea6e3b5752e (diff) | |
libaltos: Need to check for tty/ttyACMx before ttyACMx
Otherwise, we'll find 'tty' when looking for 'ttyACMx' and no good
will come from that
Signed-off-by: Keith Packard <keithp@keithp.com>
| -rw-r--r-- | libaltos/libaltos.c | 16 | 
1 files changed, 8 insertions, 8 deletions
diff --git a/libaltos/libaltos.c b/libaltos/libaltos.c index 505b3147..ca56746a 100644 --- a/libaltos/libaltos.c +++ b/libaltos/libaltos.c @@ -478,26 +478,26 @@ usb_tty(char *sys)  				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);  | 
