aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-helper-fs-publish.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-10-09 19:44:55 +0000
committerChristian Grothoff <christian@grothoff.org>2012-10-09 19:44:55 +0000
commit0f3f18619f8be179adbe13a2d2c39b03d3e5ec01 (patch)
tree5f1a7e6360e500db16af6924bfc2774f3489f00f /src/fs/gnunet-helper-fs-publish.c
parent9a9444bed9a086a2b87c17b3327f7c7c975aeb35 (diff)
downloadgnunet-0f3f18619f8be179adbe13a2d2c39b03d3e5ec01.tar.gz
gnunet-0f3f18619f8be179adbe13a2d2c39b03d3e5ec01.zip
-install sigpipe handler
Diffstat (limited to 'src/fs/gnunet-helper-fs-publish.c')
-rw-r--r--src/fs/gnunet-helper-fs-publish.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/fs/gnunet-helper-fs-publish.c b/src/fs/gnunet-helper-fs-publish.c
index 45f6d588d..8df53a6c3 100644
--- a/src/fs/gnunet-helper-fs-publish.c
+++ b/src/fs/gnunet-helper-fs-publish.c
@@ -402,6 +402,31 @@ extract_files (struct ScanTreeNode *item)
402} 402}
403 403
404 404
405#ifndef WINDOWS
406/**
407 * Install a signal handler to ignore SIGPIPE.
408 */
409static void
410ignore_sigpipe ()
411{
412 struct sigaction oldsig;
413 struct sigaction sig;
414
415 memset (&sig, 0, sizeof (struct sigaction));
416 sig.sa_handler = SIG_IGN;
417 sigemptyset (&sig.sa_mask);
418#ifdef SA_INTERRUPT
419 sig.sa_flags = SA_INTERRUPT; /* SunOS */
420#else
421 sig.sa_flags = SA_RESTART;
422#endif
423 if (0 != sigaction (SIGPIPE, &sig, &oldsig))
424 fprintf (stderr,
425 "Failed to install SIGPIPE handler: %s\n", strerror (errno));
426}
427#endif
428
429
405/** 430/**
406 * Main function of the helper process to extract meta data. 431 * Main function of the helper process to extract meta data.
407 * 432 *
@@ -427,6 +452,8 @@ int main(int argc,
427 /* Get utf-8-encoded arguments */ 452 /* Get utf-8-encoded arguments */
428 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 453 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
429 return 5; 454 return 5;
455#else
456 ignore_sigpipe ();
430#endif 457#endif
431 458
432 /* parse command line */ 459 /* parse command line */