From 72a9e5a2d3788f5465eb5e1610f2402744054f2e Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 8 Dec 2009 11:06:04 +0100 Subject: tiny refactoring of signal and pipe code --- grapher/grapher.cxx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/grapher/grapher.cxx b/grapher/grapher.cxx index 1e5e30b8..567b0405 100644 --- a/grapher/grapher.cxx +++ b/grapher/grapher.cxx @@ -227,19 +227,14 @@ int StapLauncher::launch() &ChildDeathReader::ioCallback), signalPipe[0], Glib::IO_IN); } + struct sigaction action; + action.sa_sigaction = handleChild; + sigemptyset(&action.sa_mask); + action.sa_flags = SA_SIGINFO | SA_NOCLDSTOP; + sigaction(SIGCLD, &action, 0); } - struct sigaction action; - action.sa_sigaction = handleChild; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO | SA_NOCLDSTOP; - sigaction(SIGCLD, &action, 0); int pipefd[4]; - if (pipe(&pipefd[0]) < 0) - { - std::perror("pipe"); - exit(1); - } - if (pipe(&pipefd[2]) < 0) + if (pipe(&pipefd[0]) < 0 || pipe(&pipefd[2]) < 0) { std::perror("pipe"); exit(1); -- cgit