From: Andre Noll Date: Wed, 10 Oct 2007 18:04:03 +0000 (+0200) Subject: Get rid of E_SIGNAL_PIPE. X-Git-Tag: v0.3.0~284 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=dcf9594fa041cdfae819186ed7e145d079110318 Get rid of E_SIGNAL_PIPE. If creation of the signal pipe fails, we abort anyway. So print the errno in the fatal log message instead of the fact that the create failed. --- diff --git a/error.h b/error.h index d2481900..cc953d28 100644 --- a/error.h +++ b/error.h @@ -265,7 +265,6 @@ extern const char **para_errlist[]; PARA_ERROR(SIGNAL_SIG_ERR, "signal() retured SIG_ERR"), \ PARA_ERROR(SIGNAL_READ, "read error from signal pipe"), \ PARA_ERROR(WAITPID, "waitpid error"), \ - PARA_ERROR(SIGNAL_PIPE, "failed to setup signal pipe"), \ #define STRING_ERRORS \ diff --git a/signal.c b/signal.c index bf0cd5cc..1db008ca 100644 --- a/signal.c +++ b/signal.c @@ -16,7 +16,7 @@ static int signal_pipe[2]; /** - * initialize the paraslash signal subsystem + * Initialize the paraslash signal subsystem. * * This function creates a pipe, the signal pipe, to deliver pending * signals to the application (Bernstein's trick). It should be called @@ -35,9 +35,11 @@ static int signal_pipe[2]; */ int para_signal_init(void) { - int ret = -E_SIGNAL_PIPE; - if (pipe(signal_pipe)) + int ret; + if (pipe(signal_pipe) < 0) { + ret = -ERRNO_TO_PARA_ERROR(errno); goto err_out; + } ret = mark_fd_nonblock(signal_pipe[0]); if (ret < 0) goto err_out; @@ -122,7 +124,7 @@ int para_install_sighandler(int sig) * This should be called if the fd for the signal pipe is ready for reading. * * \return On success, the number of the received signal is returned. \p - * -E_SIGNAL_READ is returned if a read error occured while reading the signal + * -E_SIGNAL_READ is returned if a read error occurred while reading the signal * pipe. If the read was interrupted by another signal the function returns 0. */ int para_next_signal(void)