changeset 478:214bf504c54f

Handle broken pipe as it is expected behavior
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 24 Apr 2014 10:39:09 +0000
parents 48161978c84c
children a055847decbc
files cinst/nssstore_linux.c
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;
         }
     }

http://wald.intevation.org/projects/trustbridge/