If a lot message is not intended for output, it can close the input
pipe prematurely, which can trigger a sigpipe error.  Instead, always
redirect input somewhere, so that the input pipe is not prematuring
closed.  This should help fix the SIGPIPE error that we're seeing in

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=635711
---
 src/share/common | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/share/common b/src/share/common
index 1a228b0..ae67697 100755
--- a/src/share/common
+++ b/src/share/common
@@ -36,6 +36,7 @@ log() {
     local priority
     local level
     local output
+    local finalout
     local alllevels
     local found=
 
@@ -50,6 +51,7 @@ log() {
 
     # just go ahead and return if the log level is silent
     if [ "$LOG_LEVEL" = 'SILENT' ] ; then
+       cat >/dev/null
        return
     fi
 
@@ -76,13 +78,18 @@ log() {
            output=true
        fi
        if [ "$priority" = "$level" -a "$output" = 'true' ] ; then
-           if [ "$1" ] ; then
-               echo "$@"
-           else
-               cat
-           fi | sed 's/^/'"${LOG_PREFIX}"'/' >&2
+           finalout=true
        fi
     done
+    if [ "$finalout" = 'true' ] ; then
+       if [ "$1" ] ; then
+           echo "$@"
+       else
+           cat
+       fi | sed 's/^/'"${LOG_PREFIX}"'/' >&2
+    else
+       cat >/dev/null
+    fi
 }
 
 # run command as monkeysphere user
-- 
2.1.1


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to