From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>,
Michael Tretter <m.tretter@pengutronix.de>
Subject: [PATCH 2/2] blspec: devicetree-overlay: don't warn on multiple delimiting spaces
Date: Mon, 14 Sep 2020 17:27:11 +0200 [thread overview]
Message-ID: <20200914152711.3693-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20200914152711.3693-1-a.fatoum@pengutronix.de>
strsep unlike strtok(_r) returns an empty string for each pair of
consecutive delimiters.
blspec_apply_oftree_overlay is not equipped to handle an empty
string and will attempt treating "abspath/" as device tree file.
Explicitly check for empty strings, so this doesn't happen.
Cc: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Change is untested
---
common/blspec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/common/blspec.c b/common/blspec.c
index 9e1036c8342c..ed66352d1107 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -109,8 +109,11 @@ static void blspec_apply_oftree_overlays(const char *overlays,
sep = freep = xstrdup(overlays);
- while ((overlay = strsep(&sep, " ")))
+ while ((overlay = strsep(&sep, " "))) {
+ if (!*overlay)
+ continue;
blspec_apply_oftree_overlay(overlay, abspath, dryrun);
+ }
free(freep);
}
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-09-14 15:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-14 15:27 [PATCH 1/2] boot: ignore all spaces between boot targets Ahmad Fatoum
2020-09-14 15:27 ` Ahmad Fatoum [this message]
2020-09-15 7:31 ` 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=20200914152711.3693-2-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=m.tretter@pengutronix.de \
/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