diff options
author | Ron Yorston <rmy@pobox.com> | 2023-03-19 10:24:43 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-03-19 10:24:43 +0000 |
commit | 6de29a7e5346bea9c1c2ad4faf4010ee78f1a97b (patch) | |
tree | 22adeab617d92cf7daec18e1b067f6e41d8a2945 /win32 | |
parent | cb50586aedc9725fb14dbb25263bba1598726037 (diff) | |
download | busybox-w32-6de29a7e5346bea9c1c2ad4faf4010ee78f1a97b.tar.gz busybox-w32-6de29a7e5346bea9c1c2ad4faf4010ee78f1a97b.tar.bz2 busybox-w32-6de29a7e5346bea9c1c2ad4faf4010ee78f1a97b.zip |
runuser,drop: code shrink
Make quote_arg() always return an allocated string so we can free
it unconditionally.
Always use argv[1] as the first part of the command string.
Saves 48 bytes.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/process.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/win32/process.c b/win32/process.c index 7db7741fd..428d6c703 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -163,7 +163,7 @@ quote_arg(const char *arg) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | if (!force_quotes && n == 0) { | 165 | if (!force_quotes && n == 0) { |
166 | return (char*)arg; | 166 | return xstrdup(arg); |
167 | } | 167 | } |
168 | 168 | ||
169 | /* insert double quotes and backslashes where necessary */ | 169 | /* insert double quotes and backslashes where necessary */ |
@@ -275,8 +275,7 @@ spawnveq(int mode, const char *path, char *const *argv, char *const *env) | |||
275 | 275 | ||
276 | done: | 276 | done: |
277 | for (i = 0;i < argc;i++) | 277 | for (i = 0;i < argc;i++) |
278 | if (new_argv[i] != argv[i]) | 278 | free(new_argv[i]); |
279 | free(new_argv[i]); | ||
280 | free(new_argv); | 279 | free(new_argv); |
281 | free(new_path); | 280 | free(new_path); |
282 | 281 | ||