diff options
-rw-r--r-- | win32/mingw.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 8588b1a86..977848a2a 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -2292,28 +2292,19 @@ int chdir_system_drive(void) | |||
2292 | * This function is used to make relative paths absolute before a call | 2292 | * This function is used to make relative paths absolute before a call |
2293 | * to chdir_system_drive(). It's unlikely to be useful in other cases. | 2293 | * to chdir_system_drive(). It's unlikely to be useful in other cases. |
2294 | * | 2294 | * |
2295 | * If the argument is an absolute path or a relative path which resolves | 2295 | * If the argument is an absolute path return 'path', otherwise return |
2296 | * to a path on the system drive return 'path'. If it's a relative path | 2296 | * an allocated string containing the resolved path. Die on failure, |
2297 | * which resolves to a path that isn't on the system drive return an | ||
2298 | * allocated string containing the resolved path. Die on failure, | ||
2299 | * which is most likely because the file doesn't exist. | 2297 | * which is most likely because the file doesn't exist. |
2300 | */ | 2298 | */ |
2301 | char *xabsolute_path(char *path) | 2299 | char *xabsolute_path(char *path) |
2302 | { | 2300 | { |
2303 | char *rpath; | 2301 | char *rpath; |
2304 | const char *sd; | ||
2305 | 2302 | ||
2306 | if (root_len(path) != 0) | 2303 | if (root_len(path) != 0) |
2307 | return path; // absolute path | 2304 | return path; // absolute path |
2308 | rpath = xmalloc_realpath(path); | 2305 | rpath = xmalloc_realpath(path); |
2309 | if (rpath) { | 2306 | if (rpath) |
2310 | sd = get_system_drive(); | ||
2311 | if (sd && is_prefixed_with_case(rpath, sd)) { | ||
2312 | free(rpath); | ||
2313 | return path; // resolved path is on system drive | ||
2314 | } | ||
2315 | return rpath; | 2307 | return rpath; |
2316 | } | ||
2317 | bb_perror_msg_and_die("can't open '%s'", path); | 2308 | bb_perror_msg_and_die("can't open '%s'", path); |
2318 | } | 2309 | } |
2319 | 2310 | ||