[PATCH] Handle broken pipe as it is expected behavior

Wald Commits scm-commit at wald.intevation.org
Thu Apr 24 12:39:14 CEST 2014


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1398335949 0
# Node ID 214bf504c54f9dd00dfd9c18c80c62f62955d5b5
# Parent  48161978c84c92bb01e03a2488dc6a487f5c0c94
Handle broken pipe as it is expected behavior

diff -r 48161978c84c -r 214bf504c54f cinst/nssstore_linux.c
--- a/cinst/nssstore_linux.c	Thu Apr 24 10:32:14 2014 +0000
+++ b/cinst/nssstore_linux.c	Thu Apr 24 10:39:09 2014 +0000
@@ -189,7 +189,14 @@
     {
       if (fprintf (stream, "I:%s\n", to_install[i]) <= 3)
         {
-          ERRORPRINTF ("Write failed: %s \n", strerror(errno));
+          int err = errno;
+          ERRORPRINTF ("Write failed: %s \n", strerror(err));
+          if (err == 32)
+            {
+              /* Broken pipe is expected if there are no NSS stores
+                 to be found the process just exits. That's ok */
+              success = true;
+            }
           goto done;
         }
     }
@@ -198,7 +205,14 @@
     {
       if (fprintf (stream, "R:%s\n", to_remove[i]) <= 3)
         {
-          ERRORPRINTF ("Write failed: %s \n", strerror(errno));
+          int err = errno;
+          ERRORPRINTF ("Write failed: %s \n", strerror(err));
+          if (err == 32)
+            {
+              /* Broken pipe is expected if there are no NSS stores
+                 to be found the process just exits. That's ok */
+              success = true;
+            }
           goto done;
         }
     }


More information about the Trustbridge-commits mailing list