From: Rafał Miłecki Date: Fri, 5 Jan 2018 14:24:30 +0000 (+0100) Subject: libfstools: optimize building directory string for glob X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=2a9a6ea4ac221f913ea318d7ac17ff2c31bdf5c2;p=project%2Ffstools.git libfstools: optimize building directory string for glob glob should handle paths like /foo/bar//* so we probably don't need this extra check & code. Signed-off-by: Rafał Miłecki --- 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++) {