From: Bruno Haible Date: Sun, 31 Aug 2008 13:54:18 +0000 (+0000) Subject: SIGPIPE handling. X-Git-Tag: v0.18~358 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7256171d638183d7e643fbd410860b2f6e6b11dd;p=thirdparty%2Fgettext.git SIGPIPE handling. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index d58682bd1..c91fd670a 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,8 @@ +2008-08-31 Bruno Haible + + * msgexec.c: Include . + (main): Block SIGPIPE for the duration of the processing. + 2008-08-23 Bruno Haible 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 345044dfc..2db3f23b0 100644 --- a/gettext-tools/src/msgexec.c +++ b/gettext-tools/src/msgexec.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -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. */