aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-12-14 15:27:54 +0000
committerRon Yorston <rmy@pobox.com>2018-12-14 17:41:29 +0000
commita236242374daf911a01e998fabb1cc1268b2be7b (patch)
tree5e30a868b8580a645f94003e27bf96d6ebcd0ee1 /include
parent575581082befff0e049ef67fa36bbdd2ca737e29 (diff)
downloadbusybox-w32-a236242374daf911a01e998fabb1cc1268b2be7b.tar.gz
busybox-w32-a236242374daf911a01e998fabb1cc1268b2be7b.tar.bz2
busybox-w32-a236242374daf911a01e998fabb1cc1268b2be7b.zip
win32: special treatment for PATH
The PATH shell variable is a special case. It can be exported to the environment where it might be interpreted by native applications which assume the separator is ';'. Hence: - require that the separator used in PATH is ';' - enforce this by intercepting calls to setvareq() that set PATH and adjusting its value if necessary. As a result of this the code to parse PATH can be simplified by replacing the hardcoded Unix ':' path separator by the platform- dependent macro PATH_SEP. The MANPATH variable is also required to use ';' as its separator but since it's less likely to be used this isn't enforced.
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h6
-rw-r--r--include/mingw.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/include/libbb.h b/include/libbb.h
index a17da9c1f..8b18782c8 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -2130,7 +2130,13 @@ extern const char bb_busybox_exec_path[] ALIGN1;
2130#ifndef BB_ADDITIONAL_PATH 2130#ifndef BB_ADDITIONAL_PATH
2131#define BB_ADDITIONAL_PATH "" 2131#define BB_ADDITIONAL_PATH ""
2132#endif 2132#endif
2133#if !ENABLE_PLATFORM_MINGW32
2133#define BB_PATH_ROOT_PATH "PATH=/sbin:/usr/sbin:/bin:/usr/bin" BB_ADDITIONAL_PATH 2134#define BB_PATH_ROOT_PATH "PATH=/sbin:/usr/sbin:/bin:/usr/bin" BB_ADDITIONAL_PATH
2135#define PATH_SEP ':'
2136#else
2137#define BB_PATH_ROOT_PATH "PATH=/sbin;/usr/sbin;/bin;/usr/bin" BB_ADDITIONAL_PATH
2138#define PATH_SEP ';'
2139#endif
2134extern const char bb_PATH_root_path[] ALIGN1; /* BB_PATH_ROOT_PATH */ 2140extern const char bb_PATH_root_path[] ALIGN1; /* BB_PATH_ROOT_PATH */
2135#define bb_default_root_path (bb_PATH_root_path + sizeof("PATH")) 2141#define bb_default_root_path (bb_PATH_root_path + sizeof("PATH"))
2136/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin, 2142/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
diff --git a/include/mingw.h b/include/mingw.h
index 8a695d2d2..cef53a7c9 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -443,7 +443,6 @@ int mingw_execve(const char *cmd, char *const *argv, char *const *envp);
443#define execve mingw_execve 443#define execve mingw_execve
444#define execv mingw_execv 444#define execv mingw_execv
445 445
446const char * next_path_sep(const char *path);
447#define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':') 446#define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':')
448#define is_absolute_path(path) ((path)[0] == '/' || (path)[0] == '\\' || has_dos_drive_prefix(path)) 447#define is_absolute_path(path) ((path)[0] == '/' || (path)[0] == '\\' || has_dos_drive_prefix(path))
449 448