File: aptdropprivs.cc

package info (click to toggle)
apt 3.1.13
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 22,764 kB
  • sloc: cpp: 71,085; sh: 31,750; xml: 5,553; perl: 217; python: 197; ansic: 191; makefile: 41
file content (27 lines) | stat: -rw-r--r-- 687 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <config.h>

#include <apt-pkg/cmndline.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>

#include <unistd.h>

int main(int const argc, const char * argv[])
{
   CommandLine::Args Args[] = {
      {'c',"config-file",0,CommandLine::ConfigFile},
      {'o',"option",0,CommandLine::ArbItem},
      {0, "user", "APT::Sandbox::User", CommandLine::HasArg},
      {0,0,0,0}
   };

   CommandLine CmdL(Args, _config);
   if(CmdL.Parse(argc,argv) == false || DropPrivileges() == false)
   {
      _error->DumpErrors(std::cerr, GlobalError::DEBUG);
      return 42;
   }

   return execv(CmdL.FileList[0], const_cast<char**>(CmdL.FileList));
}