diff cinst/nssstore_linux.c @ 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 e8d761c2d2d1
children e41a2537b84d
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/