From 718e78b68da623db88bdc9693c2d85b5c562df2e Mon Sep 17 00:00:00 2001 From: "Nathan S. Evans" Date: Fri, 30 Jul 2010 11:38:16 +0000 Subject: [PATCH] ignore sigpipe --- src/util/common_logging.c | 16 ++++++++++++++++ src/util/scheduler.c | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 7bd39c7ca..aa051333b 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c @@ -478,6 +478,22 @@ GNUNET_h2s (const GNUNET_HashCode * hc) return (const char *) ret.encoding; } +/** + * Convert a hash to a string (for printing debug messages). + * This is one of the very few calls in the entire API that is + * NOT reentrant! + * + * @param hc the hash code + * @return string form; will be overwritten by next call to GNUNET_h2s_full. + */ +const char * +GNUNET_h2s_full (const GNUNET_HashCode * hc) +{ + static struct GNUNET_CRYPTO_HashAsciiEncoded ret; + GNUNET_CRYPTO_hash_to_enc (hc, &ret); + ret.encoding[104] = '\0'; + return (const char *) ret.encoding; +} /** * Convert a peer identity to a string (for printing debug messages). diff --git a/src/util/scheduler.c b/src/util/scheduler.c index ccf82148f..9623382f7 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c @@ -623,6 +623,16 @@ run_ready (struct GNUNET_SCHEDULER_Handle *sched, */ static struct GNUNET_DISK_PipeHandle *sigpipe; +/** + * Signal handler called for sigpipe. + * + * FIXME: what should we do here? + */ +static void +sighandler_pipe () +{ + return; +} /** * Signal handler called for signals that should cause us to shutdown. @@ -664,6 +674,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) struct GNUNET_SIGNAL_Context *shc_term; struct GNUNET_SIGNAL_Context *shc_quit; struct GNUNET_SIGNAL_Context *shc_hup; + struct GNUNET_SIGNAL_Context *shc_pipe; unsigned long long last_tr; unsigned int busy_wait_warning; const struct GNUNET_DISK_FileHandle *pr; @@ -676,6 +687,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) GNUNET_assert (sigpipe != NULL); pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); GNUNET_assert (pr != NULL); + shc_pipe = GNUNET_SIGNAL_handler_install (SIGPIPE, &sighandler_pipe); shc_int = GNUNET_SIGNAL_handler_install (SIGINT, &sighandler_shutdown); shc_term = GNUNET_SIGNAL_handler_install (SIGTERM, &sighandler_shutdown); #ifndef MINGW -- 2.25.1