diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2011-01-04 19:30:41 +0700 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2011-01-04 19:30:41 +0700 |
commit | 2b9a0e715ec459198f486653023d963b79291da7 (patch) | |
tree | 15eb01adfa64a95e8b28bb82c07792f43e29df65 | |
parent | d9c358ba831824913a37d578be35e2df3b1705e4 (diff) | |
download | busybox-w32-2b9a0e715ec459198f486653023d963b79291da7.tar.gz busybox-w32-2b9a0e715ec459198f486653023d963b79291da7.tar.bz2 busybox-w32-2b9a0e715ec459198f486653023d963b79291da7.zip |
win32: ash: fix path_advance() not advancing correctly
*p can be either ':' or ';' at the end of path_advance(). However the
code expects it to be ':' only. This effectively skips the rest of
$PATH after the first component when Windows' $PATH is used. This
should fix Github#1.
While at it, also fix pathopt code expecting ':' only (again).
-rw-r--r-- | shell/ash.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index 5c24762f2..f1f044cbf 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -2449,10 +2449,19 @@ path_advance(const char **path, const char *name) | |||
2449 | pathopt = NULL; | 2449 | pathopt = NULL; |
2450 | if (*p == '%') { | 2450 | if (*p == '%') { |
2451 | pathopt = ++p; | 2451 | pathopt = ++p; |
2452 | #if ENABLE_PLATFORM_MINGW32 | ||
2453 | p = next_path_sep(start); | ||
2454 | |||
2455 | /* *p != ':' and '*' would suffice */ | ||
2456 | if (!p) | ||
2457 | p = pathopt - 1; | ||
2458 | #else | ||
2452 | while (*p && *p != ':') | 2459 | while (*p && *p != ':') |
2453 | p++; | 2460 | p++; |
2461 | #endif | ||
2454 | } | 2462 | } |
2455 | if (*p == ':') | 2463 | if (*p == ':' || |
2464 | (ENABLE_PLATFORM_MINGW32 && *p == ';')) | ||
2456 | *path = p + 1; | 2465 | *path = p + 1; |
2457 | else | 2466 | else |
2458 | *path = NULL; | 2467 | *path = NULL; |