std::cout << "\n" << std::flush;
}
+ /*}}}*/
+// AcqMethod::DropPrivsOrDie - Drop privileges or die /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgAcqMethod::DropPrivsOrDie()
+{
+ if (!DropPrivs()) {
+ Fail(false);
+ exit(112); /* call the european emergency number */
+ }
+}
+
/*}}}*/
// AcqMethod::URIStart - Indicate a download is starting /*{{{*/
// ---------------------------------------------------------------------
pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
virtual ~pkgAcqMethod() {};
-
+ void DropPrivsOrDie();
private:
APT_HIDDEN void Dequeue();
};
{
setlocale(LC_ALL, "");
- DropPrivs();
-
CopyMethod Mth;
+
+ Mth.DropPrivsOrDie();
return Mth.Run();
}
{
setlocale(LC_ALL, "");
- // no more active ftp, sorry
- DropPrivs();
-
/* See if we should be come the http client - we do this for http
proxy urls */
if (getenv("ftp_proxy") != 0)
}
FtpMethod Mth;
+
+ // no more active ftp, sorry
+ Mth.DropPrivsOrDie();
return Mth.Run();
}
int main()
{
setlocale(LC_ALL, "");
-
- DropPrivs();
GPGVMethod Mth;
+ Mth.DropPrivsOrDie();
+
return Mth.Run();
}
{
setlocale(LC_ALL, "");
- DropPrivs();
-
Prog = strrchr(argv[0],'/');
++Prog;
GzipMethod Mth;
+
+ Mth.DropPrivsOrDie();
+
return Mth.Run();
}
// closes the connection (this is dealt with via ServerDie())
signal(SIGPIPE, SIG_IGN);
- DropPrivs();
-
HttpMethod Mth;
+
+ Mth.DropPrivsOrDie();
return Mth.Loop();
}
{
setlocale(LC_ALL, "");
- DropPrivs();
-
HttpsMethod Mth;
curl_global_init(CURL_GLOBAL_SSL) ;
+ Mth.DropPrivsOrDie();
+
return Mth.Run();
}