diff --git a/sim_fio.c b/sim_fio.c index 44ccea44..eb97b9eb 100644 --- a/sim_fio.c +++ b/sim_fio.c @@ -809,7 +809,10 @@ while ((c = strstr (fullpath, "/../"))) { /* process up directory climbing else break; } -name = 1 + strrchr (fullpath, '/'); +if (!strrchr (fullpath, '/')) + name = fullpath + strlen (fullpath); +else + name = 1 + strrchr (fullpath, '/'); ext = strrchr (name, '.'); if (ext == NULL) ext = name + strlen (name);