From 2a9a6ea4ac221f913ea318d7ac17ff2c31bdf5c2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 5 Jan 2018 15:24:30 +0100 Subject: [PATCH] libfstools: optimize building directory string for glob MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit glob should handle paths like /foo/bar//* so we probably don't need this extra check & code. Signed-off-by: Rafał Miłecki --- 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