From 5a59fe81fc52b55b079d047f3baa37130207f23d Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 18 Nov 2019 16:57:20 -0800 Subject: [PATCH] FIO: Fix directory scanning logic to avoid errors handling files in / --- sim_fio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sim_fio.c b/sim_fio.c index 9bfecde3..6fef8ea9 100644 --- a/sim_fio.c +++ b/sim_fio.c @@ -782,7 +782,9 @@ else { return NULL; } strlcpy (fullpath, dir, tot_len); - strlcat (fullpath, "/", tot_len); + if ((dir[strlen (dir) - 1] != '/') && /* if missing a trailing directory separator? */ + (dir[strlen (dir) - 1] != '\\')) + strlcat (fullpath, "/", tot_len); /* then add one */ strlcat (fullpath, filepath, tot_len); } while ((c = strchr (fullpath, '\\'))) /* standardize on / directory separator */