/*
- * Copyright (C) 2004-2008 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2004-2009 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
*/
static void generic_signal_handler(int s)
{
- write(signal_pipe[1], &s, sizeof(int));
- //fprintf(stderr, "got sig %i, write returned %d\n", s, ret);
+ ssize_t ret = write(signal_pipe[1], &s, sizeof(int));
+
+ if (ret == sizeof(int))
+ return;
+ if (ret < 0)
+ PARA_EMERG_LOG("%s\n", strerror(errno));
+ else
+ PARA_EMERG_LOG("short write to signal pipe\n");
+ exit(EXIT_FAILURE);
}
/**
* one otherwise. If and only if the function returns one, the content of \a
* pid is meaningful.
*
- * \sa waitpid(2)
+ * \sa waitpid(2).
*/
int para_reap_child(pid_t *pid)
{
}
/**
- * wrapper around signal(2)
- * \param sig the number of the signal to catch
+ * Wrapper around signal(2).
+ *
+ * \param sig The number of the signal to catch.
*
* This installs the generic signal handler for the given signal.
+ *
* \return This function returns 1 on success and \p -E_SIGNAL_SIG_ERR on errors.
- * \sa signal(2)
+ *
+ * \sa signal(2).
*/
int para_install_sighandler(int sig)
{
}
/**
- * Close the signal pipe.
+ * Close the write end of the signal pipe.
*/
void para_signal_shutdown(void)
{