Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / ExternalProgram.cc
index fbdffd2..ee1821d 100644 (file)
@@ -476,23 +476,20 @@ namespace zypp {
          } while ( true );
        }
 
-       if ( pid > 0 )  // bsc#1109877: must re-check! running() in the loop above may have already waited.
+       // Wait for child to exit
+       int ret;
+       int status = 0;
+       do
        {
-         // Wait for child to exit
-         int ret;
-         int status = 0;
-         do
-         {
-           ret = waitpid(pid, &status, 0);
-         }
-         while (ret == -1 && errno == EINTR);
+         ret = waitpid(pid, &status, 0);
+       }
+       while (ret == -1 && errno == EINTR);
 
-         if (ret != -1)
-         {
-           _exitStatus = checkStatus( status );
-         }
-         pid = -1;
+       if (ret != -1)
+       {
+        _exitStatus = checkStatus( status );
        }
+       pid = -1;
       }
 
       return _exitStatus;
@@ -601,7 +598,7 @@ namespace zypp {
     //
     //////////////////////////////////////////////////////////////////////
 
-    namespace _ExternalProgram
+    namespace externalprogram
     {
       EarlyPipe::EarlyPipe()
       {
@@ -622,7 +619,7 @@ namespace zypp {
        if ( _stderr )
          ::fclose( _stderr );
       }
-    }
+    } // namespace externalprogram
 
     bool ExternalProgramWithStderr::stderrGetUpTo( std::string & retval_r, const char delim_r, bool returnDelim_r )
     {