summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:54:59 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:54:59 +0000
commit1b6d659c38ff5fd44aa4bc22f28cfeae43e8f8f5 (patch)
tree47d40c6f3b2b30f4aa2c79b543621a8dc86da9fe /cmdline/apt-get.cc
parentdd57cc0575d443c1cf302c948e6368a17a0a4d7a (diff)
Fixed locking of archives dir
Author: jgg Date: 1999-10-24 06:03:48 GMT Fixed locking of archives dir
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r--cmdline/apt-get.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index a30c9833d..d7727c7d3 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-get.cc,v 1.83 1999/10/22 05:58:54 jgg Exp $
+// $Id: apt-get.cc,v 1.84 1999/10/24 06:03:48 jgg Exp $
/* ######################################################################
apt-get - Cover for dpkg
@@ -1216,6 +1216,15 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
/* */
bool DoClean(CommandLine &CmdL)
{
+ // Lock the archive directory
+ FileFd Lock;
+ if (_config->FindB("Debug::NoLocking",false) == false)
+ {
+ Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
+ if (_error->PendingError() == true)
+ return _error->Error("Unable to lock the download directory");
+ }
+
pkgAcquire Fetcher;
Fetcher.Clean(_config->FindDir("Dir::Cache::archives"));
Fetcher.Clean(_config->FindDir("Dir::Cache::archives") + "partial/");
@@ -1240,6 +1249,15 @@ class LogCleaner : public pkgArchiveCleaner
bool DoAutoClean(CommandLine &CmdL)
{
+ // Lock the archive directory
+ FileFd Lock;
+ if (_config->FindB("Debug::NoLocking",false) == false)
+ {
+ Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
+ if (_error->PendingError() == true)
+ return _error->Error("Unable to lock the download directory");
+ }
+
CacheFile Cache;
if (Cache.Open() == false)
return false;