Call detect on a device file when it doesn't exist, not when already exists. Fixes: 00e5e596df ("file_list: add file_list_detect_all()") Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- common/file-list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/file-list.c b/common/file-list.c index 40ccfa97ec..6298f8f82d 100644 --- a/common/file-list.c +++ b/common/file-list.c @@ -287,7 +287,7 @@ int file_list_detect_all(const struct file_list *files) int i = 0; list_for_each_entry(fentry, &files->list, list) { - if (stat(fentry->filename, &s)) + if (!stat(fentry->filename, &s)) continue; if (device_detect_by_name(devpath_to_name(fentry->filename)) == 0) i++; -- 2.39.5