diff options
-rw-r--r-- | libbb/get_last_path_component.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libbb/get_last_path_component.c b/libbb/get_last_path_component.c index 254aabafd..9d017ab7f 100644 --- a/libbb/get_last_path_component.c +++ b/libbb/get_last_path_component.c | |||
@@ -72,18 +72,16 @@ char* FAST_FUNC bb_get_last_path_component_nostrip(const char *path) | |||
72 | */ | 72 | */ |
73 | char* FAST_FUNC bb_get_last_path_component_strip(char *path) | 73 | char* FAST_FUNC bb_get_last_path_component_strip(char *path) |
74 | { | 74 | { |
75 | char *slash = last_char_is(path, '/'); | ||
76 | |||
77 | #if ENABLE_PLATFORM_MINGW32 | 75 | #if ENABLE_PLATFORM_MINGW32 |
76 | char *slash = last_char_is_dir_sep(path); | ||
78 | const char *start = has_dos_drive_prefix(path) ? path+2 : path; | 77 | const char *start = has_dos_drive_prefix(path) ? path+2 : path; |
79 | 78 | ||
80 | if (!slash) | ||
81 | slash = last_char_is(path, '\\'); | ||
82 | |||
83 | if (slash) | 79 | if (slash) |
84 | while ((*slash == '/' || *slash == '\\') && slash != start) | 80 | while (is_dir_sep(*slash) && slash != start) |
85 | *slash-- = '\0'; | 81 | *slash-- = '\0'; |
86 | #else | 82 | #else |
83 | char *slash = last_char_is(path, '/'); | ||
84 | |||
87 | if (slash) | 85 | if (slash) |
88 | while (*slash == '/' && slash != path) | 86 | while (*slash == '/' && slash != path) |
89 | *slash-- = '\0'; | 87 | *slash-- = '\0'; |