mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] file-list: fix file_list_detect_all()
Date: Mon, 20 Jan 2025 14:26:25 +0100	[thread overview]
Message-ID: <20250120132625.4176071-1-s.hauer@pengutronix.de> (raw)

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@pengutronix.de>
---
 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




             reply	other threads:[~2025-01-20 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-20 13:26 Sascha Hauer [this message]
2025-01-22  7:41 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250120132625.4176071-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox