mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Fix crash bug when user presses ^C
darcs-hash:20050924195242-ac50b-f94edc21751e0202808f44bf732e050173a82fea.gz
This commit is contained in:
parent
bee8f2c721
commit
0085156a05
2 changed files with 15 additions and 25 deletions
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
* common.h, common.c: Make DEBUG_LEVEL constant into debug_level runtime configurable variable
|
* common.h, common.c: Make DEBUG_LEVEL constant into debug_level runtime configurable variable
|
||||||
|
|
||||||
|
* proc.h (handle_child_status): Fix crash bug when user presses ^C
|
||||||
|
|
||||||
2005-09-23 Axel Liljencrantz <axel@liljencrantz.se>
|
2005-09-23 Axel Liljencrantz <axel@liljencrantz.se>
|
||||||
|
|
||||||
|
|
35
proc.c
35
proc.c
|
@ -512,13 +512,6 @@ static void mark_process_status( job_t *j,
|
||||||
if (WIFSTOPPED (status))
|
if (WIFSTOPPED (status))
|
||||||
{
|
{
|
||||||
p->stopped = 1;
|
p->stopped = 1;
|
||||||
// fwprintf( stderr, L"Proc %d (%ls) stopped\n", p->pid, p->actual_cmd );
|
|
||||||
|
|
||||||
/* sprintf( mess,
|
|
||||||
"%ls (%d): Process stopped\n",
|
|
||||||
j->command,
|
|
||||||
(int) p->pid );
|
|
||||||
write( 2, mess, strlen(mess) );*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -529,8 +522,9 @@ static void mark_process_status( job_t *j,
|
||||||
(! WIFSIGNALED( status )) )
|
(! WIFSIGNALED( status )) )
|
||||||
{
|
{
|
||||||
/* This should never be reached */
|
/* This should never be reached */
|
||||||
char mess[128];
|
char mess[MESS_SIZE];
|
||||||
sprintf( mess,
|
snprintf( mess,
|
||||||
|
MESS_SIZE,
|
||||||
"Process %d exited abnormally\n",
|
"Process %d exited abnormally\n",
|
||||||
(int) p->pid );
|
(int) p->pid );
|
||||||
|
|
||||||
|
@ -546,9 +540,9 @@ static void mark_process_status( job_t *j,
|
||||||
static void handle_child_status( pid_t pid, int status )
|
static void handle_child_status( pid_t pid, int status )
|
||||||
{
|
{
|
||||||
int found_proc = 0;
|
int found_proc = 0;
|
||||||
job_t *j;
|
job_t *j=0;
|
||||||
process_t *p;
|
process_t *p=0;
|
||||||
char mess[MESS_SIZE];
|
// char mess[MESS_SIZE];
|
||||||
found_proc = 0;
|
found_proc = 0;
|
||||||
/*
|
/*
|
||||||
snprintf( mess,
|
snprintf( mess,
|
||||||
|
@ -612,18 +606,13 @@ static void handle_child_status( pid_t pid, int status )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
block_t *c = current_block;
|
block_t *c = current_block;
|
||||||
|
if( p && found_proc )
|
||||||
snprintf( mess,
|
|
||||||
MESS_SIZE,
|
|
||||||
"Process %ls from job %ls exited through signal, breaking loops\n",
|
|
||||||
p->actual_cmd,
|
|
||||||
j->command );
|
|
||||||
write( 2, mess, strlen(mess ));
|
|
||||||
|
|
||||||
while( c )
|
|
||||||
{
|
{
|
||||||
c->skip=1;
|
while( c )
|
||||||
c=c->outer;
|
{
|
||||||
|
c->skip=1;
|
||||||
|
c=c->outer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue