mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
virSCSIHostFindByPCI: Fix link detection
Inside of virSCSIHostFindByPCI() there's a loop which iterates of entries of "/sys/class/scsi_host" directory trying to identify all symlinks (which then point to a SCSI device, but that's not important right now). But the way virFileIsLink() is called can never return a truthful reply - because it's called over dent->d_name instead of full path. Fix this by moving the virFileIsLink() call and passing constructed path into it. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
20a719dce6
commit
e8a83aab5d
@ -107,11 +107,11 @@ virSCSIHostFindByPCI(const char *sysfs_prefix,
|
|||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
unsigned int read_unique_id;
|
unsigned int read_unique_id;
|
||||||
|
|
||||||
if (!virFileIsLink(entry->d_name))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
host_link = g_strdup_printf("%s/%s", prefix, entry->d_name);
|
host_link = g_strdup_printf("%s/%s", prefix, entry->d_name);
|
||||||
|
|
||||||
|
if (!virFileIsLink(host_link))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (virFileResolveLink(host_link, &host_path) < 0)
|
if (virFileResolveLink(host_link, &host_path) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user