mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 07:43:18 +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
7
exec.c
7
exec.c
|
@ -450,6 +450,7 @@ 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] );
|
||||
|
||||
|
@ -457,6 +458,8 @@ static void launch_process( process_t *p )
|
|||
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,7 +478,6 @@ static void launch_process( process_t *p )
|
|||
{
|
||||
int count = 0;
|
||||
int i = 1;
|
||||
int j = 2;
|
||||
wchar_t **res;
|
||||
|
||||
while( p->argv[count] != 0 )
|
||||
|
@ -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