// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: dpkgpm.cc,v 1.13 1999/07/30 06:15:14 jgg Exp $
+// $Id: dpkgpm.cc,v 1.16 1999/12/12 03:48:36 jgg Exp $
/* ######################################################################
DPKG Package Manager - Provide an interface to dpkg
SetCloseExec(STDOUT_FILENO,false);
SetCloseExec(STDIN_FILENO,false);
SetCloseExec(STDERR_FILENO,false);
-
- const char *Args[5];
+
+ const char *Args[4];
Args[0] = "/bin/sh";
- Args[1] = "/bin/sh";
- Args[2] = "-c";
- Args[3] = Opts->Value.c_str();
- Args[4] = 0;
+ Args[1] = "-c";
+ Args[2] = Opts->Value.c_str();
+ Args[3] = 0;
execv(Args[0],(char **)Args);
_exit(100);
}
FileFd Fd(Pipes[1]);
// Feed it the filenames.
- for (vector<Item>::iterator I = List.begin(); I != List.end();)
+ for (vector<Item>::iterator I = List.begin(); I != List.end(); I++)
{
// Only deal with packages to be installed from .deb
if (I->Op != Item::Install)
kill(Process,SIGINT);
Fd.Close();
ExecWait(Process,Opts->Value.c_str(),true);
- return false;
- }
+ return _error->Error("Failure running script %s",Opts->Value.c_str());
+ }
}
Fd.Close();
// Clean up the sub process
if (ExecWait(Process,Opts->Value.c_str()) == false)
- return false;
+ return _error->Error("Failure running script %s",Opts->Value.c_str());
}
return true;
/* No Job Control Stop Env is a magic dpkg var that prevents it
from using sigstop */
- setenv("DPKG_NO_TSTP","yes",1);
+ putenv("DPKG_NO_TSTP=yes");
execvp(Args[0],(char **)Args);
cerr << "Could not exec dpkg!" << endl;
_exit(100);
{
RunScripts("DPkg::Post-Invoke");
if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV)
- return _error->Error("Sub-process recieved a segmentation fault.");
+ return _error->Error("Sub-process %s recieved a segmentation fault.",Args[0]);
if (WIFEXITED(Status) != 0)
- return _error->Error("Sub-process returned an error code (%u)",WEXITSTATUS(Status));
+ return _error->Error("Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status));
- return _error->Error("Sub-process exited unexpectedly");
+ return _error->Error("Sub-process %s exited unexpectedly",Args[0]);
}
}