diff options
| author | Ron Yorston <rmy@pobox.com> | 2021-02-14 12:27:27 +0000 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2021-02-14 12:27:27 +0000 |
| commit | 4340e4d3d581c438a8634868c838f73b9018fb8b (patch) | |
| tree | 6a58026ab635aa819524360f81d6799bd7aa1dab | |
| parent | 0168043f32e0ed03e3742d0b5768c49c1df27bff (diff) | |
| download | busybox-w32-4340e4d3d581c438a8634868c838f73b9018fb8b.tar.gz busybox-w32-4340e4d3d581c438a8634868c838f73b9018fb8b.tar.bz2 busybox-w32-4340e4d3d581c438a8634868c838f73b9018fb8b.zip | |
ash: code shrink
Since there's only one call to mingw_spawn_forkshell() we might
as well just call spawnve() directly from ash.
| -rw-r--r-- | include/mingw.h | 1 | ||||
| -rw-r--r-- | shell/ash.c | 2 | ||||
| -rw-r--r-- | win32/process.c | 9 |
3 files changed, 1 insertions, 11 deletions
diff --git a/include/mingw.h b/include/mingw.h index e2c02babf..f16d086e2 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
| @@ -484,7 +484,6 @@ int utimes(const char *file_name, const struct timeval times[2]); | |||
| 484 | pid_t FAST_FUNC mingw_spawn(char **argv); | 484 | pid_t FAST_FUNC mingw_spawn(char **argv); |
| 485 | pid_t FAST_FUNC mingw_spawn_detach(char **argv); | 485 | pid_t FAST_FUNC mingw_spawn_detach(char **argv); |
| 486 | intptr_t FAST_FUNC mingw_spawn_proc(const char **argv); | 486 | intptr_t FAST_FUNC mingw_spawn_proc(const char **argv); |
| 487 | intptr_t FAST_FUNC mingw_spawn_forkshell(const char **argv); | ||
| 488 | int mingw_execv(const char *cmd, char *const *argv); | 487 | int mingw_execv(const char *cmd, char *const *argv); |
| 489 | int mingw_execvp(const char *cmd, char *const *argv); | 488 | int mingw_execvp(const char *cmd, char *const *argv); |
| 490 | int mingw_execve(const char *cmd, char *const *argv, char *const *envp); | 489 | int mingw_execve(const char *cmd, char *const *argv, char *const *envp); |
diff --git a/shell/ash.c b/shell/ash.c index f8a18cdc5..5c6eb5759 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -15713,7 +15713,7 @@ spawn_forkshell(struct forkshell *fs, struct job *jp, union node *n, int mode) | |||
| 15713 | new->nprocs = jp == NULL ? 0 : jp->nprocs; | 15713 | new->nprocs = jp == NULL ? 0 : jp->nprocs; |
| 15714 | sprintf(buf, "%p", new->hMapFile); | 15714 | sprintf(buf, "%p", new->hMapFile); |
| 15715 | argv[2] = buf; | 15715 | argv[2] = buf; |
| 15716 | ret = mingw_spawn_forkshell(argv); | 15716 | ret = spawnve(P_NOWAIT, bb_busybox_exec_path, (char *const *)argv, environ); |
| 15717 | CloseHandle(new->hMapFile); | 15717 | CloseHandle(new->hMapFile); |
| 15718 | UnmapViewOfFile(new); | 15718 | UnmapViewOfFile(new); |
| 15719 | if (ret == -1) { | 15719 | if (ret == -1) { |
diff --git a/win32/process.c b/win32/process.c index 6e758e601..9e0740d6d 100644 --- a/win32/process.c +++ b/win32/process.c | |||
| @@ -400,15 +400,6 @@ mingw_spawn_proc(const char **argv) | |||
| 400 | return mingw_spawn_1(P_NOWAIT, argv[0], (char *const *)argv, environ); | 400 | return mingw_spawn_1(P_NOWAIT, argv[0], (char *const *)argv, environ); |
| 401 | } | 401 | } |
| 402 | 402 | ||
| 403 | #if ENABLE_ASH || ENABLE_SH_IS_ASH || ENABLE_BASH_IS_ASH | ||
| 404 | intptr_t FAST_FUNC | ||
| 405 | mingw_spawn_forkshell(const char **argv) | ||
| 406 | { | ||
| 407 | return spawnve(P_NOWAIT, bb_busybox_exec_path, (char *const *)argv, | ||
| 408 | environ); | ||
| 409 | } | ||
| 410 | #endif | ||
| 411 | |||
| 412 | int | 403 | int |
| 413 | mingw_execvp(const char *cmd, char *const *argv) | 404 | mingw_execvp(const char *cmd, char *const *argv) |
| 414 | { | 405 | { |
