Preserve the value of errno across the signal handler.

This commit is contained in:
Christopher Kohlhoff 2011-03-23 09:48:24 +11:00
parent fc815f1c85
commit d73439e218

View File

@ -61,9 +61,11 @@ void asio_signal_handler(int signal_number)
#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
signal_set_service::deliver_signal(signal_number);
#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
int saved_errno = errno;
signal_state* state = get_signal_state();
(void)::write(state->write_descriptor_,
&signal_number, sizeof(signal_number));
errno = saved_errno;
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
#if !defined(ASIO_HAS_SIGACTION)