X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/76d97c26ae8ca9d55c1e44a13eb0a013f0adc592..e5a1f2ff4cd1300364c7c644958583a8af704173:/apt-pkg/acquire-worker.cc diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 28f8408b6..4c204041a 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-worker.cc,v 1.15 1998/12/05 01:45:20 jgg Exp $ +// $Id: acquire-worker.cc,v 1.20 1999/03/16 00:43:55 jgg Exp $ /* ###################################################################### Acquire Worker @@ -20,13 +20,15 @@ #include #include #include -#include +#include #include #include +#include #include #include #include +#include /*}}}*/ // Worker::Worker - Constructor for Queue startup /*{{{*/ @@ -130,13 +132,24 @@ 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(); Args[1] = 0; execv(Args[0],(char **)Args); cerr << "Failed to exec method " << Args[0] << endl; - exit(100); + _exit(100); } // Fix up our FDs @@ -257,7 +270,12 @@ bool pkgAcquire::Worker::RunMessages() { if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true || StringToBool(LookupTag(Message,"Alt-IMS-Hit"),false) == true) - Log->IMSHit(Desc); + { + /* Hide 'hits' for local only sources - we also manage to + hide gets */ + if (Config->LocalOnly == false) + Log->IMSHit(Desc); + } else Log->Done(Desc); } @@ -276,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; } @@ -428,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();