summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
authorMichael Vogt <egon@bottom>2008-01-07 21:26:11 +0100
committerMichael Vogt <egon@bottom>2008-01-07 21:26:11 +0100
commit187b88d8d90ee10b2e2e14ba762be2fdd9fce744 (patch)
treefbb090aa431bcd89a7207b20d3b585ff43456d8e /apt-pkg/deb
parent0a626f9e3738d5ff70b81820b3c497a4a50f589c (diff)
parentf0983ff2091df782027a2e344cbd9e3df43c1450 (diff)
* apt-pkg/packagemanager.{cc,h}:
- propergate the Immediate flag to make hitting the "E: Internal Error, Could not perform immediate configuration (2)" harder * debian/control: - build against libdb-dev (instead of libdb4.4-dev) * merged the apt--DoListUpdate branch, this provides a common interface for "apt-get update" like operations for the frontends and also provides hooks to run stuff in APT::Update::{Pre,Post}-Invoke
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/dpkgpm.cc71
-rw-r--r--apt-pkg/deb/dpkgpm.h1
2 files changed, 5 insertions, 67 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index d796146fa..34e166447 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -14,6 +14,7 @@
#include <apt-pkg/depcache.h>
#include <apt-pkg/strutl.h>
#include <apti18n.h>
+#include <apt-pkg/fileutl.h>
#include <unistd.h>
#include <stdlib.h>
@@ -95,68 +96,6 @@ bool pkgDPkgPM::Remove(PkgIterator Pkg,bool Purge)
return true;
}
/*}}}*/
-// DPkgPM::RunScripts - Run a set of scripts /*{{{*/
-// ---------------------------------------------------------------------
-/* This looks for a list of script sto run from the configuration file,
- each one is run with system from a forked child. */
-bool pkgDPkgPM::RunScripts(const char *Cnf)
-{
- Configuration::Item const *Opts = _config->Tree(Cnf);
- if (Opts == 0 || Opts->Child == 0)
- return true;
- Opts = Opts->Child;
-
- // Fork for running the system calls
- pid_t Child = ExecFork();
-
- // This is the child
- if (Child == 0)
- {
- if (chdir("/tmp/") != 0)
- _exit(100);
-
- unsigned int Count = 1;
- for (; Opts != 0; Opts = Opts->Next, Count++)
- {
- if (Opts->Value.empty() == true)
- continue;
-
- if (system(Opts->Value.c_str()) != 0)
- _exit(100+Count);
- }
- _exit(0);
- }
-
- // Wait for the child
- int Status = 0;
- while (waitpid(Child,&Status,0) != Child)
- {
- if (errno == EINTR)
- continue;
- return _error->Errno("waitpid","Couldn't wait for subprocess");
- }
-
- // Restore sig int/quit
- signal(SIGQUIT,SIG_DFL);
- signal(SIGINT,SIG_DFL);
-
- // Check for an error code.
- if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)
- {
- unsigned int Count = WEXITSTATUS(Status);
- if (Count > 100)
- {
- Count -= 100;
- for (; Opts != 0 && Count != 1; Opts = Opts->Next, Count--);
- _error->Error("Problem executing scripts %s '%s'",Cnf,Opts->Value.c_str());
- }
-
- return _error->Error("Sub-process returned an error code");
- }
-
- return true;
-}
- /*}}}*/
// DPkgPM::SendV2Pkgs - Send version 2 package info /*{{{*/
// ---------------------------------------------------------------------
/* This is part of the helper script communication interface, it sends
@@ -342,8 +281,8 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
*/
void pkgDPkgPM::DoStdin(int master)
{
- char input_buf[256] = {0,};
- int len = read(0, input_buf, sizeof(input_buf));
+ unsigned char input_buf[256] = {0,};
+ ssize_t len = read(0, input_buf, sizeof(input_buf));
if (len)
write(master, input_buf, len);
else
@@ -357,9 +296,9 @@ void pkgDPkgPM::DoStdin(int master)
*/
void pkgDPkgPM::DoTerminalPty(int master)
{
- char term_buf[1024] = {0,};
+ unsigned char term_buf[1024] = {0,0, };
- int len=read(master, term_buf, sizeof(term_buf));
+ ssize_t len=read(master, term_buf, sizeof(term_buf));
if(len == -1 && errno == EIO)
{
// this happens when the child is about to exit, we
diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h
index 81a888f05..ebc7e32bf 100644
--- a/apt-pkg/deb/dpkgpm.h
+++ b/apt-pkg/deb/dpkgpm.h
@@ -64,7 +64,6 @@ class pkgDPkgPM : public pkgPackageManager
vector<Item> List;
// Helpers
- bool RunScripts(const char *Cnf);
bool RunScriptsWithPkgs(const char *Cnf);
bool SendV2Pkgs(FILE *F);