aboutsummaryrefslogtreecommitdiffhomepage
path: root/exec.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-31 18:06:20 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-31 18:06:20 -0800
commitbeece6a8288614e7dda22e7994e679878ec971de (patch)
tree505e3e6323440f0617915cbb51df0916aeac6025 /exec.cpp
parent207ab2aa5bff997a32971f4e5c4d79ebfd644764 (diff)
Clean up how argv is stored in process_t
Diffstat (limited to 'exec.cpp')
-rw-r--r--exec.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/exec.cpp b/exec.cpp
index a25f6ce5..1361955d 100644
--- a/exec.cpp
+++ b/exec.cpp
@@ -534,29 +534,20 @@ static void launch_process( process_t *p )
if( (read==1) && (begin[0] == ':') )
{
- int count = 0;
- int i = 1;
- wchar_t **res;
- char **res_real;
-
- while( p->argv(count) != 0 )
- count++;
-
- res = (wchar_t **)malloc( sizeof(wchar_t*)*(count+3));
- const wchar_t *sh_command = L"/bin/sh";
- res[0] = wcsdup(sh_command);
- res[1] = wcsdup(p->actual_cmd);
-
- for( i=1; p->argv(i) != NULL; i++ ){
- res[i+1] = wcsdup(p->argv(i));
+ wcstring_list_t argv;
+
+ const wchar_t *sh_command = L"/bin/sh";
+ argv.push_back(sh_command);
+ argv.push_back(p->actual_cmd);
+ for(size_t i=1; p->argv(i) != NULL; i++ ){
+ argv.push_back(p->argv(i));
}
- res[i+1] = 0;
- p->set_argv(res);
+ p->set_argv(argv);
p->actual_cmd = wcsdup(sh_command);
- res_real = wcsv2strv( (const wchar_t **) res);
+ char **res_real = wcsv2strv( p->get_argv() );
execve ( wcs2str(p->actual_cmd),
res_real,