summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r--cmdline/apt-get.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 6268f4953..00e6aaa67 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1380,6 +1380,15 @@ bool DoUpgrade(CommandLine &CmdL)
/* Install named packages */
bool DoInstall(CommandLine &CmdL)
{
+ // Lock the list directory
+ FileFd Lock;
+ if (_config->FindB("Debug::NoLocking",false) == false)
+ {
+ Lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock"));
+ if (_error->PendingError() == true)
+ return _error->Error(_("Unable to lock the list directory"));
+ }
+
CacheFile Cache;
if (Cache.OpenForInstall() == false ||
Cache.CheckDeps(CmdL.FileSize() != 1) == false)