summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire.cc7
-rw-r--r--apt-pkg/cdrom.cc7
2 files changed, 10 insertions, 4 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 07c4646f5..0c815c005 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -92,8 +92,11 @@ void pkgAcquire::Initialize()
static bool SetupAPTPartialDirectory(std::string const &grand, std::string const &parent)
{
std::string const partial = parent + "partial";
- if (CreateAPTDirectoryIfNeeded(grand, partial) == false &&
- CreateAPTDirectoryIfNeeded(parent, partial) == false)
+ mode_t const mode = umask(S_IWGRP | S_IWOTH);
+ bool const creation_fail = (CreateAPTDirectoryIfNeeded(grand, partial) == false &&
+ CreateAPTDirectoryIfNeeded(parent, partial) == false);
+ umask(mode);
+ if (creation_fail == true)
return false;
std::string const SandboxUser = _config->Find("APT::Sandbox::User");
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index b97f7b036..aaa7b82e0 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -822,8 +822,11 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/
// check for existence and possibly create state directory for copying
string const listDir = _config->FindDir("Dir::State::lists");
string const partialListDir = listDir + "partial/";
- if (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::State"), partialListDir) == false &&
- CreateAPTDirectoryIfNeeded(listDir, partialListDir) == false)
+ mode_t const mode = umask(S_IWGRP | S_IWOTH);
+ bool const creation_fail = (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::State"), partialListDir) == false &&
+ CreateAPTDirectoryIfNeeded(listDir, partialListDir) == false);
+ umask(mode);
+ if (creation_fail == true)
{
UnmountCDROM(CDROM, NULL);
return _error->Errno("cdrom", _("List directory %spartial is missing."), listDir.c_str());