]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-worker.cc
Changed ie to eg
[apt.git] / apt-pkg / acquire-worker.cc
index 1ac6e8528d164c28af9909b54b9ff62dddf2086b..4c204041a1676a7287ee059e9200afe4e01f6208 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire-worker.cc,v 1.18 1999/01/27 02:48:52 jgg Exp $
+// $Id: acquire-worker.cc,v 1.20 1999/03/16 00:43:55 jgg Exp $
 /* ######################################################################
 
    Acquire Worker 
 
 #include <sys/stat.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include <signal.h>
 #include <wait.h>
 #include <stdio.h>
+#include <errno.h>
                                                                        /*}}}*/
 
 // Worker::Worker - Constructor for Queue startup                      /*{{{*/
@@ -130,6 +132,17 @@ bool pkgAcquire::Worker::Start()
       SetCloseExec(STDOUT_FILENO,false);
       SetCloseExec(STDIN_FILENO,false);      
       SetCloseExec(STDERR_FILENO,false);
+
+      signal(SIGPIPE,SIG_DFL);
+      signal(SIGQUIT,SIG_DFL);
+      signal(SIGINT,SIG_DFL);
+      signal(SIGWINCH,SIG_DFL);
+      signal(SIGCONT,SIG_DFL);
+      signal(SIGTSTP,SIG_DFL);
+      
+      // Close all of our FDs - just in case
+      for (int K = 3; K != 40; K++)
+        fcntl(K,F_SETFD,FD_CLOEXEC);
       
       const char *Args[2];
       Args[0] = Method.c_str();
@@ -281,12 +294,12 @@ bool pkgAcquire::Worker::RunMessages()
            pkgAcquire::Item *Owner = Itm->Owner;
            pkgAcquire::ItemDesc Desc = *Itm;
            OwnerQ->ItemDone(Itm);
-           Owner->Failed(Message);
+           Owner->Failed(Message,Config);
            ItemDone();
-           
+
            if (Log != 0)
               Log->Fail(Desc);
-           
+
            break;
         }       
         
@@ -433,7 +446,13 @@ bool pkgAcquire::Worker::QueueItem(pkgAcquire::Queue::QItem *Item)
 /* */
 bool pkgAcquire::Worker::OutFdReady()
 {
-   int Res = write(OutFd,OutQueue.begin(),OutQueue.length());
+   int Res;
+   do
+   {
+      Res = write(OutFd,OutQueue.begin(),OutQueue.length());
+   }
+   while (Res < 0 && errno == EINTR);
+   
    if (Res <= 0)
       return MethodFailure();