aboutsummaryrefslogtreecommitdiff
path: root/win32/process.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2017-08-28 19:04:26 +0100
committerRon Yorston <rmy@pobox.com>2017-08-30 17:17:14 +0100
commit862e1bd8d6117d5b44e3ab431b3a6837d8e44040 (patch)
tree925f6a6e2f9d676fe20a63f00bbcd1595a895c3e /win32/process.c
parent0599746d9bcf513c4898cbd1a46ef1d5b3478627 (diff)
downloadbusybox-w32-862e1bd8d6117d5b44e3ab431b3a6837d8e44040.tar.gz
busybox-w32-862e1bd8d6117d5b44e3ab431b3a6837d8e44040.tar.bz2
busybox-w32-862e1bd8d6117d5b44e3ab431b3a6837d8e44040.zip
win32: shrink code to detect .exe files
Add a function (has_exe_suffix) to replace explicit code to check if a filename ends with '.exe. or '.com'. Also shrink code that checks for '.exe' or '.com' on PATH in shell's find_command function.
Diffstat (limited to 'win32/process.c')
-rw-r--r--win32/process.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/win32/process.c b/win32/process.c
index 5eb52828b..919d46043 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -52,10 +52,7 @@ parse_interpreter(const char *cmd, char ***opts, int *nopts)
52 *opts = opt; 52 *opts = opt;
53 53
54 /* don't even try a .exe */ 54 /* don't even try a .exe */
55 n = strlen(cmd); 55 if (has_exe_suffix(cmd))
56 if (n >= 4 &&
57 (!strcasecmp(cmd+n-4, ".exe") ||
58 !strcasecmp(cmd+n-4, ".com")))
59 return NULL; 56 return NULL;
60 57
61 fd = open(cmd, O_RDONLY); 58 fd = open(cmd, O_RDONLY);