Commit 8eed2e95 authored by Thomas Schmitt's avatar Thomas Schmitt

New mode bit8 with burn_set_signal_handling() to particularly ignore SIGPIPE

parent abe560a6
#define Cdrskin_timestamP "2013.06.28.104316"
#define Cdrskin_timestamP "2013.07.01.155958"
......@@ -133,15 +133,27 @@ static void Cleanup_handler_generic(int signum)
}
static char *Cleanup_signo_to_name(int signo)
{
int i;
for(i= 0; i < signal_list_count; i++)
if(signal_list[i] == signo)
return(signal_name_list[i]);
return("");
}
int Cleanup_set_handlers(void *handle, Cleanup_app_handler_T handler, int flag)
/*
bit0= set to default handlers
bit1= set to ignore
bit2= set cleanup_perform_app_handler_first
bit3= set SIGABRT to handler (makes sense with bits 0 or 1)
bit8= set SIGPIPE to SIGIGN
*/
{
int i,j,max_sig= -1,min_sig= 0x7fffffff;
char *sig_name;
sighandler_t sig_handler;
cleanup_msg[0]= 0;
......@@ -172,8 +184,17 @@ int Cleanup_set_handlers(void *handle, Cleanup_app_handler_T handler, int flag)
if(i==non_signal_list[j])
break;
if(j>=non_signal_list_count) {
if(i==SIGABRT && (flag&8))
/* Avoid to use particular SIG macros which might not be defined.
If ithey are defined, then their names are in the name list.
*/
if(flag & (8 | 256))
sig_name= Cleanup_signo_to_name(i);
else
sig_name= "";
if((flag & 8) && strcmp(sig_name, "SIGABRT") == 0)
signal(i,Cleanup_handler_generic);
else if((flag & 256) && strcmp(sig_name, "SIGPIPE") == 0)
signal(i, SIG_IGN);
else
signal(i,sig_handler);
}
......
......@@ -549,7 +549,7 @@ void burn_set_signal_handling(void *handle, burn_abort_handler_t handler,
if(burn_builtin_signal_action == 0)
burn_builtin_signal_action = 1;
Cleanup_set_handlers(handle, (Cleanup_app_handler_T) handler,
(mode & 15) | 4);
(mode & 15) | 4 | (mode & 256));
burn_global_signal_handle = handle;
burn_global_signal_handler = handler;
}
......
......@@ -3771,6 +3771,9 @@ typedef int (*burn_abort_handler_t)(void *handle, int signum, int flag);
drives to become idle. E.g. by calling burn_abort(>0).
4 Like 3, but without calling burn_abort(-1). Only the
indicator of burn_is_aborting() gets set.
bit8: @since 1.3.2
try to ignore SIGPIPE (regardless of bit0 - bit3)
@since 0.2.6
*/
void burn_set_signal_handling(void *handle, burn_abort_handler_t handler,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment