]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/fileutl.cc
* apt-pkg/acquire-worker.cc:
[apt.git] / apt-pkg / contrib / fileutl.cc
index 536571fee1ecc58fe90b6b704b448c9566f4f51e..e9d1ba1ce0af72b0274935573fc084961c135915 100644 (file)
@@ -1098,6 +1098,12 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
            dup2(d->compressed_fd,STDIN_FILENO);
         dup2(Pipe[1],STDOUT_FILENO);
       }
+      int const nullfd = open("/dev/null", O_WRONLY);
+      if (nullfd != -1)
+      {
+        dup2(nullfd,STDERR_FILENO);
+        close(nullfd);
+      }
 
       SetCloseExec(STDOUT_FILENO,false);
       SetCloseExec(STDIN_FILENO,false);
@@ -1301,6 +1307,28 @@ bool FileFd::Write(const void *From,unsigned long long Size)
    
    Flags |= Fail;
    return _error->Error(_("write, still have %llu to write but couldn't"), Size);
+}
+bool FileFd::Write(int Fd, const void *From, unsigned long long Size)
+{
+   int Res;
+   errno = 0;
+   do
+   {
+      Res = write(Fd,From,Size);
+      if (Res < 0 && errno == EINTR)
+        continue;
+      if (Res < 0)
+        return _error->Errno("write",_("Write error"));
+
+      From = (char *)From + Res;
+      Size -= Res;
+   }
+   while (Res > 0 && Size > 0);
+
+   if (Size == 0)
+      return true;
+
+   return _error->Error(_("write, still have %llu to write but couldn't"), Size);
 }
                                                                        /*}}}*/
 // FileFd::Seek - Seek in the file                                     /*{{{*/