On 11/02/2011 02:42 PM, Paul Eggert wrote:

While I was at it, I made sure PIPE was SIG_DFL, removing an
unwarranted assumption in the current test.

Sorry, but it is not possible in portable shell to reset SIGPIPE to SIG_DFL if the shell itself was started with SIGPIPE as SIG_IGN. That's because POSIX explicitly states that trap is allowed to be a silent no-op on any signal that was inherited as ignored into the shell. You have to resort to an intermediary process (a simple C program or one-liner perl script will do) if you want to ensure that you are invoking a child shell script with SIGPIPE at default handling.


+if (trap - PIPE)>/dev/null 2>&1; then
+  trap - PIPE

Thus, this does not work to reset SIGPIPE if the shell itself was started with SIGPIPE ignored.

--
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Reply via email to