HOSTED_BMP_ONLY/linux: Fix case when no serial device is connected #806

This commit is contained in:
Uwe Bonnes 2020-12-12 14:13:18 +01:00 committed by UweBonnes
parent 93d4c65948
commit 14498decd9
1 changed files with 2 additions and 5 deletions

View File

@ -209,15 +209,12 @@ static int scan_linux_id(char *name, char *type, char *version, char *serial)
int find_debuggers(BMP_CL_OPTIONS_t *cl_opts, bmp_info_t *info) int find_debuggers(BMP_CL_OPTIONS_t *cl_opts, bmp_info_t *info)
{ {
char name[4096];
if (cl_opts->opt_device) if (cl_opts->opt_device)
return 1; return 1;
info->bmp_type = BMP_TYPE_BMP; info->bmp_type = BMP_TYPE_BMP;
DIR *dir = opendir(DEVICE_BY_ID); DIR *dir = opendir(DEVICE_BY_ID);
if (!dir) { if (!dir) /* No serial device connected!*/
DEBUG_WARN("Could not opendir %s: %s\n", name, strerror(errno)); return 0;
return -1;
}
int found_bmps = 0; int found_bmps = 0;
struct dirent *dp; struct dirent *dp;
int i = 0; int i = 0;