From e8d7a8baaffbd9060842c8fa959fb5dabf8c0c43 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Thu, 25 Jul 2024 21:28:01 -0400 Subject: simulator: Fix browsing into secondary drive on multidrive targets Change-Id: I4e993acdedb516f0ae4fc230a62cb00de8dcef86 --- uisimulator/common/filesystem-sim.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'uisimulator/common') diff --git a/uisimulator/common/filesystem-sim.c b/uisimulator/common/filesystem-sim.c index 7a3418021e..786f17e644 100644 --- a/uisimulator/common/filesystem-sim.c +++ b/uisimulator/common/filesystem-sim.c @@ -307,9 +307,12 @@ int sim_get_os_path(char *buffer, const char *path, size_t bufsize) #ifdef HAVE_MULTIVOLUME if (level != 1) break; /* Volume spec only valid @ root level */ + if (p[-1] != PATH_SEPCH) + break; const char *next; - volume = path_strip_volume(p, &next, true); + volume = path_strip_volume(p-1, &next, true); + if (volume == ROOT_VOLUME) volume = 0; /* FIXME: root no longer implies volume 0 */ @@ -831,7 +834,7 @@ int os_volume_path(IF_MV(int volume, ) char *buffer, size_t bufsize) char volname[VOL_MAX_LEN + 1]; get_volume_name(volume, volname); - if (path_append(tmpbuf, PA_SEP_HARD, volname, sizeof (volname)) + if (path_append(tmpbuf, PA_SEP_HARD, volname, sizeof (tmpbuf)) >= sizeof (volname)) return -1; #endif /* HAVE_MULTIVOLUME */ -- cgit v1.2.3