From: Rafał Miłecki <ra...@milecki.pl>

glob should handle paths like /foo/bar//* so we probably don't need this
extra check & code.

Signed-off-by: Rafał Miłecki <ra...@milecki.pl>
---
This optimization/simplification was suggested by Jo while reviewing
[PATCH] libfstools: support file paths longer than 255 chars
---
 libfstools/overlay.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libfstools/overlay.c b/libfstools/overlay.c
index e610b8d..0187a55 100644
--- a/libfstools/overlay.c
+++ b/libfstools/overlay.c
@@ -86,10 +86,7 @@ foreachdir(const char *dir, int (*cb)(const char*))
                globdirlen = len;
        }
 
-       if (dir[dirlen - 1] == '/')
-               sprintf(globdir, "%s*", dir);
-       else
-               sprintf(globdir, "%s/*", dir);
+       sprintf(globdir, "%s/*", dir);
 
        if (!glob(globdir, GLOB_NOESCAPE | GLOB_MARK | GLOB_ONLYDIR, NULL, &gl))
                for (j = 0; j < gl.gl_pathc; j++) {
-- 
2.11.0


_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to