aboutsummaryrefslogtreecommitdiff
path: root/win32
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 /win32
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 'win32')
-rw-r--r--win32/process.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/win32/process.c b/win32/process.c
index 60fea01ad..37496db7b 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -24,26 +24,6 @@ int waitpid(pid_t pid, int *status, int options)
24 return -1; 24 return -1;
25} 25}
26 26
27const char *
28next_path_sep(const char *path)
29{
30 static const char *from = NULL, *to;
31 static int has_semicolon;
32 int len = strlen(path);
33
34 if (!from || !(path >= from && path+len <= to)) {
35 from = path;
36 to = from+len;
37 has_semicolon = strchr(path, ';') != NULL;
38 }
39
40 /* Semicolons take precedence, it's Windows PATH */
41 if (has_semicolon)
42 return strchr(path, ';');
43 /* PATH=C:, not really a separator */
44 return strchr(has_dos_drive_prefix(path) ? path+2 : path, ':');
45}
46
47typedef struct { 27typedef struct {
48 char *path; 28 char *path;
49 char *name; 29 char *name;