* apt-pkg/packagemanager.{cc,h}:
authorMichael Vogt <michael.vogt@ubuntu.com>
Fri, 14 Sep 2007 13:28:14 +0000 (15:28 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Fri, 14 Sep 2007 13:28:14 +0000 (15:28 +0200)
  - move DoInstallPostFork() out of the header into the .cc file

apt-pkg/packagemanager.cc
apt-pkg/packagemanager.h

index 10e2858..d6172c6 100644 (file)
@@ -25,7 +25,7 @@
     
 #include <apti18n.h>    
 #include <iostream>
-                                                                       /*}}}*/
+#include <fcntl.h> 
 
 using namespace std;
 
@@ -624,6 +624,26 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
    return Completed;
 }
                                                                        /*}}}*/
+// PM::DoInstallPostFork - Does install part that happens after the fork /*{{{*/
+// ---------------------------------------------------------------------
+pkgPackageManager::OrderResult 
+pkgPackageManager::DoInstallPostFork(int statusFd)
+{
+      if(statusFd > 0)
+         // FIXME: use SetCloseExec here once it taught about throwing
+        //        exceptions instead of doing _exit(100) on failure
+        fcntl(statusFd,F_SETFD,FD_CLOEXEC); 
+      bool goResult = Go(statusFd);
+      if(goResult == false) 
+        return Failed;
+
+      // if all was fine update the state file
+      if(Res == Completed) {
+        Cache.writeStateFile(NULL);
+      }
+      return Res;
+};
+
 // PM::DoInstall - Does the installation                               /*{{{*/
 // ---------------------------------------------------------------------
 /* This uses the filenames in FileNames and the information in the
index adcbec3..53cd4c9 100644 (file)
@@ -90,20 +90,7 @@ class pkgPackageManager : protected pkgCache::Namespace
    };
 
    // stuff that needs to be done after the fork
-   OrderResult DoInstallPostFork(int statusFd=-1) {
-      if(statusFd > 0)
-        SetCloseExec(statusFd, true);
-      bool goResult = Go(statusFd);
-      if(goResult == false) 
-        return Failed;
-
-      // if all was fine update the state file
-      if(Res == Completed) {
-        Cache.writeStateFile(NULL);
-      }
-      return Res;
-   };
-
+   OrderResult DoInstallPostFork(int statusFd=-1);
    bool FixMissing();
    
    pkgPackageManager(pkgDepCache *Cache);