]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/packagemanager.h
* fix missing SetExecClose() call when the status-fd is used
[apt.git] / apt-pkg / packagemanager.h
index da1f21e6ce90d6db3bb86b1a7d5fbd7b710c1db4..adcbec3d0f467e748eabd89c5d94b9c9821d6bf8 100644 (file)
 #ifndef PKGLIB_PACKAGEMANAGER_H
 #define PKGLIB_PACKAGEMANAGER_H
 
 #ifndef PKGLIB_PACKAGEMANAGER_H
 #define PKGLIB_PACKAGEMANAGER_H
 
-#ifdef __GNUG__
-#pragma interface "apt-pkg/packagemanager.h"
-#endif
 
 #include <string>
 
 #include <string>
+#include <iostream>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/depcache.h>
 
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/depcache.h>
 
@@ -82,12 +80,7 @@ class pkgPackageManager : protected pkgCache::Namespace
                    pkgRecords *Recs);
 
    // Do the installation 
                    pkgRecords *Recs);
 
    // Do the installation 
-   OrderResult DoInstall() {
-      if(DoInstallPreFork() == Failed)
-        return Failed;
-
-      return DoInstallPostFork();
-   }
+   OrderResult DoInstall(int statusFd=-1);
 
    // stuff that needs to be done before the fork() of a library that
    // uses apt
 
    // stuff that needs to be done before the fork() of a library that
    // uses apt
@@ -98,14 +91,16 @@ class pkgPackageManager : protected pkgCache::Namespace
 
    // stuff that needs to be done after the fork
    OrderResult DoInstallPostFork(int statusFd=-1) {
 
    // 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;
       bool goResult = Go(statusFd);
       if(goResult == false) 
         return Failed;
-      
+
       // if all was fine update the state file
       // if all was fine update the state file
-      if(Res == Completed)
+      if(Res == Completed) {
         Cache.writeStateFile(NULL);
         Cache.writeStateFile(NULL);
-
+      }
       return Res;
    };
 
       return Res;
    };