mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 06:41:42 +08:00
Make sure errno is not changed when error reporting after a failed call to execve
darcs-hash:20070107140918-ac50b-35186f2300d6ec03dbeac2cb5d5ffcee3feffc4e.gz
This commit is contained in:
parent
42d0283489
commit
2fcec27e23
13
exec.c
13
exec.c
|
@ -450,13 +450,16 @@ static int setup_child_process( job_t *j, process_t *p )
|
|||
static void launch_process( process_t *p )
|
||||
{
|
||||
FILE* f;
|
||||
|
||||
int err;
|
||||
|
||||
// debug( 1, L"exec '%ls'", p->argv[0] );
|
||||
|
||||
execve ( wcs2str(p->actual_cmd),
|
||||
wcsv2strv( (const wchar_t **) p->argv),
|
||||
env_export_arr( 0 ) );
|
||||
|
||||
|
||||
err = errno;
|
||||
|
||||
/*
|
||||
Something went wrong with execve, check for a ":", and run
|
||||
/bin/sh if encountered. This is a weird predecessor to the shebang
|
||||
|
@ -475,8 +478,7 @@ static void launch_process( process_t *p )
|
|||
{
|
||||
int count = 0;
|
||||
int i = 1;
|
||||
int j = 2;
|
||||
wchar_t **res;
|
||||
wchar_t **res;
|
||||
|
||||
while( p->argv[count] != 0 )
|
||||
count++;
|
||||
|
@ -503,6 +505,9 @@ static void launch_process( process_t *p )
|
|||
debug( 0,
|
||||
_( L"Failed to execute process '%ls'" ),
|
||||
p->actual_cmd );
|
||||
|
||||
errno = err;
|
||||
|
||||
wperror( L"execve" );
|
||||
exit(1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user