diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-07-30 11:38:16 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-07-30 11:38:16 +0000 |
commit | 718e78b68da623db88bdc9693c2d85b5c562df2e (patch) | |
tree | 4b8f1868a991e26c606a93db068b489d5cc8d1a5 /src | |
parent | 64431cc5c9b837526e2a954a3cd24351cb2f8acf (diff) | |
download | gnunet-718e78b68da623db88bdc9693c2d85b5c562df2e.tar.gz gnunet-718e78b68da623db88bdc9693c2d85b5c562df2e.zip |
ignore sigpipe
Diffstat (limited to 'src')
-rw-r--r-- | src/util/common_logging.c | 16 | ||||
-rw-r--r-- | src/util/scheduler.c | 12 |
2 files changed, 28 insertions, 0 deletions
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) | |||
478 | return (const char *) ret.encoding; | 478 | return (const char *) ret.encoding; |
479 | } | 479 | } |
480 | 480 | ||
481 | /** | ||
482 | * Convert a hash to a string (for printing debug messages). | ||
483 | * This is one of the very few calls in the entire API that is | ||
484 | * NOT reentrant! | ||
485 | * | ||
486 | * @param hc the hash code | ||
487 | * @return string form; will be overwritten by next call to GNUNET_h2s_full. | ||
488 | */ | ||
489 | const char * | ||
490 | GNUNET_h2s_full (const GNUNET_HashCode * hc) | ||
491 | { | ||
492 | static struct GNUNET_CRYPTO_HashAsciiEncoded ret; | ||
493 | GNUNET_CRYPTO_hash_to_enc (hc, &ret); | ||
494 | ret.encoding[104] = '\0'; | ||
495 | return (const char *) ret.encoding; | ||
496 | } | ||
481 | 497 | ||
482 | /** | 498 | /** |
483 | * Convert a peer identity to a string (for printing debug messages). | 499 | * 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, | |||
623 | */ | 623 | */ |
624 | static struct GNUNET_DISK_PipeHandle *sigpipe; | 624 | static struct GNUNET_DISK_PipeHandle *sigpipe; |
625 | 625 | ||
626 | /** | ||
627 | * Signal handler called for sigpipe. | ||
628 | * | ||
629 | * FIXME: what should we do here? | ||
630 | */ | ||
631 | static void | ||
632 | sighandler_pipe () | ||
633 | { | ||
634 | return; | ||
635 | } | ||
626 | 636 | ||
627 | /** | 637 | /** |
628 | * Signal handler called for signals that should cause us to shutdown. | 638 | * 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) | |||
664 | struct GNUNET_SIGNAL_Context *shc_term; | 674 | struct GNUNET_SIGNAL_Context *shc_term; |
665 | struct GNUNET_SIGNAL_Context *shc_quit; | 675 | struct GNUNET_SIGNAL_Context *shc_quit; |
666 | struct GNUNET_SIGNAL_Context *shc_hup; | 676 | struct GNUNET_SIGNAL_Context *shc_hup; |
677 | struct GNUNET_SIGNAL_Context *shc_pipe; | ||
667 | unsigned long long last_tr; | 678 | unsigned long long last_tr; |
668 | unsigned int busy_wait_warning; | 679 | unsigned int busy_wait_warning; |
669 | const struct GNUNET_DISK_FileHandle *pr; | 680 | const struct GNUNET_DISK_FileHandle *pr; |
@@ -676,6 +687,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) | |||
676 | GNUNET_assert (sigpipe != NULL); | 687 | GNUNET_assert (sigpipe != NULL); |
677 | pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); | 688 | pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); |
678 | GNUNET_assert (pr != NULL); | 689 | GNUNET_assert (pr != NULL); |
690 | shc_pipe = GNUNET_SIGNAL_handler_install (SIGPIPE, &sighandler_pipe); | ||
679 | shc_int = GNUNET_SIGNAL_handler_install (SIGINT, &sighandler_shutdown); | 691 | shc_int = GNUNET_SIGNAL_handler_install (SIGINT, &sighandler_shutdown); |
680 | shc_term = GNUNET_SIGNAL_handler_install (SIGTERM, &sighandler_shutdown); | 692 | shc_term = GNUNET_SIGNAL_handler_install (SIGTERM, &sighandler_shutdown); |
681 | #ifndef MINGW | 693 | #ifndef MINGW |