]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Get rid of E_SIGNAL_PIPE.
authorAndre Noll <maan@systemlinux.org>
Wed, 10 Oct 2007 18:04:03 +0000 (20:04 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 10 Oct 2007 18:04:03 +0000 (20:04 +0200)
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.

error.h
signal.c

diff --git a/error.h b/error.h
index d248190002fac3860157717dd6b0da55acebcfcb..cc953d28aa4a38731257880225eea98a66611997 100644 (file)
--- 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_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 \
 
 
 #define STRING_ERRORS \
index bf0cd5ccff28286852858e1b4f22bf00f9436f7b..1db008ca89a92a23f3c08017a74be04e3e06f1d5 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -16,7 +16,7 @@
 static int signal_pipe[2];
 
 /**
 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
  *
  * 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 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;
                goto err_out;
+       }
        ret = mark_fd_nonblock(signal_pipe[0]);
        if (ret < 0)
                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
  * 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)
  * pipe.  If the read was interrupted by another signal the function returns 0.
  */
 int para_next_signal(void)