[PATCH 2/2] blspec: devicetree-overlay: don't warn on multiple delimiting spaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux