diff options
Diffstat (limited to 'firmware/common')
-rw-r--r-- | firmware/common/dir.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/firmware/common/dir.c b/firmware/common/dir.c index 7361c78067..88dbe29c80 100644 --- a/firmware/common/dir.c +++ b/firmware/common/dir.c | |||
@@ -47,17 +47,20 @@ static const char* vol_names = "<HD%d>"; | |||
47 | static int strip_volume(const char* name, char* namecopy) | 47 | static int strip_volume(const char* name, char* namecopy) |
48 | { | 48 | { |
49 | int volume = 0; | 49 | int volume = 0; |
50 | 50 | const char *temp = name; | |
51 | if (name[1] == vol_names[0] ) /* a '<' quickly identifies our volumes */ | 51 | |
52 | while (*temp && strchr("/", *temp)) /* skip all leading slashes */ | ||
53 | ++temp; | ||
54 | |||
55 | if (*temp && !strncmp(temp, vol_names, VOL_ENUM_POS)) | ||
52 | { | 56 | { |
53 | const char* temp; | 57 | temp += VOL_ENUM_POS; /* behind special name */ |
54 | temp = name + 1 + VOL_ENUM_POS; /* behind '/' and special name */ | 58 | volume = atoi(temp); /* number is following */ |
55 | volume = atoi(temp); /* number is following */ | ||
56 | temp = strchr(temp, '/'); /* search for slash behind */ | 59 | temp = strchr(temp, '/'); /* search for slash behind */ |
57 | if (temp != NULL) | 60 | if (temp != NULL) |
58 | name = temp; /* use the part behind the volume */ | 61 | name = temp; /* use the part behind the volume */ |
59 | else | 62 | else |
60 | name = "/"; /* else this must be the root dir */ | 63 | name = "/"; /* else this must be the root dir */ |
61 | } | 64 | } |
62 | 65 | ||
63 | strncpy(namecopy, name, MAX_PATH); | 66 | strncpy(namecopy, name, MAX_PATH); |