[Toxine-cvs] CVS: toxine/src commands.c,1.72,1.73 errors.c,1.2,1.3 errors.h,1.2,1.3 main.c,1.34,1.35
Brought to you by:
f1rmb
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-27 21:23:53
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24943 Modified Files: commands.c errors.c errors.h main.c Log Message: @@handle segfault. Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- commands.c 27 May 2004 00:27:39 -0000 1.72 +++ commands.c 27 May 2004 21:23:42 -0000 1.73 @@ -892,6 +892,12 @@ if(sigaction(SIGALRM, &action, NULL) != 0) fprintf(stderr, "sigaction(SIGALRM) failed: %s\n", strerror(errno)); + action.sa_handler = toxine_signals_handler; + sigemptyset(&(action.sa_mask)); + action.sa_flags = 0; + if(sigaction(SIGSEGV, &action, NULL) != 0) + fprintf(stderr, "sigaction(SIGSEGV) failed: %s\n", strerror(errno)); + if(argc) { int i; Index: errors.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/errors.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- errors.c 27 May 2004 01:08:42 -0000 1.2 +++ errors.c 27 May 2004 21:23:43 -0000 1.3 @@ -32,7 +32,7 @@ #warning Write real description { "TOX_ERR_SUCCESS", TOX_ERR_SUCCESS }, { "TOX_ERR_DEADLOCK", TOX_ERR_DEADLOCK }, - { "TOX_ERR_SEGFAULT", TOX_ERR_SEGFAULT }, + { "TOX_ERR_SIGSEGV", TOX_ERR_SIGSEGV }, { "TOX_ERR_SIGINT", TOX_ERR_SIGINT }, { "TOX_ERR_SIGTERM", TOX_ERR_SIGTERM }, { "TOX_ERR_SIGQUIT", TOX_ERR_SIGQUIT }, @@ -87,5 +87,5 @@ } } - return NULL; + return "Unknown error code."; } Index: errors.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/errors.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- errors.h 27 May 2004 01:08:42 -0000 1.2 +++ errors.h 27 May 2004 21:23:43 -0000 1.3 @@ -25,7 +25,7 @@ typedef enum { TOX_ERR_SUCCESS, /* Everything was fine */ TOX_ERR_DEADLOCK, /* Deadlock happened */ - TOX_ERR_SEGFAULT, /* SEGFAULT received */ + TOX_ERR_SIGSEGV, /* SIGSEGV received */ TOX_ERR_SIGINT, /* SIGINT received */ TOX_ERR_SIGTERM, /* SIGTERM received */ TOX_ERR_SIGQUIT, /* SIGQUIT received */ Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- main.c 27 May 2004 00:27:39 -0000 1.34 +++ main.c 27 May 2004 21:23:43 -0000 1.35 @@ -81,6 +81,11 @@ if(pid == tox->pid) { switch(sig) { + /* Segfault */ + case SIGSEGV: + exit(TOX_ERR_SIGSEGV); + break; + /* Kill the line on C-c */ case SIGINT: case SIGTERM: |