[LEDE-DEV] [PATCH fstools] libfstools: optimize building directory string for glob
Rafał Miłecki
zajec5 at gmail.com
Fri Jan 5 06:24:30 PST 2018
From: Rafał Miłecki <rafal at 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 <rafal at 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
More information about the Lede-dev
mailing list