Re: [Quickfix-developers] unitialized variables leads to undifined signal handling
Brought to you by:
orenmnero
From: Joerg T. <Joe...@ma...> - 2005-03-04 23:28:23
|
> In the original source code, sa_mask, and sa_flags are > uninitialized. If you read the man page on signaction, > this is a bad thing. In which man page did you read this? Solaris? > I added two lines > > sigemptyset( &sa.sa_mask); > sa.sa_flags = 0; > > to fix the situation > > > namespace FIX > { > void socket_init() > { QF_STACK_PUSH(socket_init) > > #ifdef _MSC_VER > WORD version = MAKEWORD( 2, 2 ); > WSADATA data; > WSAStartup( version, &data ); > #else > struct sigaction sa; > sa.sa_handler = SIG_IGN; > sigemptyset( &sa.sa_mask); > sa.sa_flags = 0; > sigaction( SIGPIPE, &sa, 0 ); > #endif > > QF_STACK_POP > } Clark, I cannot see whether in the case of SIG_IGN these fields will be used by the OS, but it is always a good idea to initialize variables. Oren did fix this in the CVS recently. Thanks, Jörg -- Joerg Thoennes http://macd.com Tel.: +49 (0)241 44597-24 Macdonald Associates GmbH Fax : +49 (0)241 44597-10 Lothringer Str. 52, D-52070 Aachen |