sysupgrade: Read the files whose names starts with section type
Currently we are reading the .bin files who are having the type
in their image names, but this has problem when the image type
is overlapping in two file names ex. wififw_ubi.bin and ubi.bin.
To avoid this problem, we will take files whose names starts
with our image type.
Change-Id: Ib3ab64fb2bbf5c9c59b1ec644c409dee31be77a1
Signed-off-by: Avinash Pandey <avinasv@codeaurora.org>
diff --git a/tools/sysupgrade.c b/tools/sysupgrade.c
index 189ebbf..a445da5 100644
--- a/tools/sysupgrade.c
+++ b/tools/sysupgrade.c
@@ -200,7 +200,7 @@
while ((file = readdir(dir)) != NULL) {
for (i = 0, sec = §ions[0]; i < NO_OF_SECTIONS; i++, sec++) {
- if (strstr(file->d_name, sec->type)) {
+ if (!strncmp(file->d_name, sec->type, strlen(sec->type))) {
if (sec->pre_op) {
strlcat(sec->tmp_file, file->d_name,
sizeof(sec->tmp_file));
@@ -245,7 +245,7 @@
while ((file = readdir(dir)) != NULL) {
for (i = 0, sec = §ions[0]; i < NO_OF_SECTIONS; i++, sec++) {
- if (strstr(file->d_name, sec->type)) {
+ if (!strncmp(file->d_name, sec->type, strlen(sec->type))) {
if (sec->pre_op) {
strlcat(sec->tmp_file, file->d_name,
sizeof(sec->tmp_file));