summaryrefslogtreecommitdiffstats
path: root/gettext-tools/src
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-08-31 13:54:18 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:15:49 +0200
commit7256171d638183d7e643fbd410860b2f6e6b11dd (patch)
treecd6969d5395af992a5421caf8a44c0e8a6a0c50d /gettext-tools/src
parent307559a7cc2841fa1787376e9b134a974386e6de (diff)
downloadexternal_gettext-7256171d638183d7e643fbd410860b2f6e6b11dd.zip
external_gettext-7256171d638183d7e643fbd410860b2f6e6b11dd.tar.gz
external_gettext-7256171d638183d7e643fbd410860b2f6e6b11dd.tar.bz2
SIGPIPE handling.
Diffstat (limited to 'gettext-tools/src')
-rw-r--r--gettext-tools/src/ChangeLog5
-rw-r--r--gettext-tools/src/msgexec.c13
2 files changed, 18 insertions, 0 deletions
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog
index d58682b..c91fd67 100644
--- a/gettext-tools/src/ChangeLog
+++ b/gettext-tools/src/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-31 Bruno Haible <bruno@clisp.org>
+
+ * msgexec.c: Include <signal.h>.
+ (main): Block SIGPIPE for the duration of the processing.
+
2008-08-23 Bruno Haible <bruno@clisp.org>
Fix behaviour of "msgmerge --update" when sorting is requested and
diff --git a/gettext-tools/src/msgexec.c b/gettext-tools/src/msgexec.c
index 345044d..2db3f23 100644
--- a/gettext-tools/src/msgexec.c
+++ b/gettext-tools/src/msgexec.c
@@ -24,6 +24,7 @@
#include <getopt.h>
#include <limits.h>
#include <locale.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -210,6 +211,18 @@ There is NO WARRANTY, to the extent permitted by law.\n\
if (strcmp (sub_name, "0") != 0)
{
+ /* Block SIGPIPE for this process and for the subprocesses.
+ The subprogram may have side effects (additionally to producing some
+ output), therefore if there are no readers on stdout, processing of the
+ strings must continue nevertheless. */
+ {
+ sigset_t sigpipe_set;
+
+ sigemptyset (&sigpipe_set);
+ sigaddset (&sigpipe_set, SIGPIPE);
+ sigprocmask (SIG_UNBLOCK, &sigpipe_set, NULL);
+ }
+
/* Attempt to locate the program.
This is an optimization, to avoid that spawn/exec searches the PATH
on every call. */