p = dlname(namelist[i]->d_name, "name"); if (!p)
di->name = dlname(namelist[i]->d_name, "name"); if (!di->name)
int dl_init(void){	int i, nr, idx;	char path[PATH_MAX], *p;	struct dirent **namelist;	struct driver_info *di;	nr = scandir(TGT_TYPE_SYSFSDIR, &namelist, filter, alphasort);	for (i = 0; i < nr; i++) {		for (p = namelist[i]->d_name; !isdigit((int) *p); p++)			;		idx = atoi(p);		if (idx > MAX_DL_HANDLES) {			eprintf("Cannot load %s %d\n",				namelist[i]->d_name, idx);			continue;		}		p = dlname(namelist[i]->d_name, "name");		if (!p)			continue;		di = &dinfo[idx];		di->name = p;		snprintf(path, sizeof(path), "%s.so", p);		di->dl = dlopen(path, RTLD_LAZY);		if (!di->dl) {			eprintf("%s %s\n", path, dlerror());			continue;		}		p = dlname(namelist[i]->d_name, "protocol");		if (!p)			continue;		di->proto = p;		snprintf(path, sizeof(path), "%s.so", p);		di->pdl = dlopen(path, RTLD_LAZY);		if (!di->pdl) {			eprintf("%s %s\n", path, dlerror());			continue;		}	}	for (i = 0; i < nr; i++)		free(namelist[i]);	free(namelist);	return 0;}