Przeglądaj źródła

Fixed locking of archives dir
Author: jgg
Date: 1999-10-24 06:03:48 GMT
Fixed locking of archives dir

Arch Librarian 22 lat temu
rodzic
commit
1b6d659c38
2 zmienionych plików z 20 dodań i 2 usunięć
  1. 19 1
      cmdline/apt-get.cc
  2. 1 1
      debian/changelog

+ 19 - 1
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;

+ 1 - 1
debian/changelog

@@ -20,11 +20,11 @@ apt (0.3.13.1) unstable; urgency=low
   * Checks for the partial directories before doing downloads Closes: #47392
   * no_proxy environment variable (http only!) Closes: #43476
   * apt-cache showsrc Closes: #45799
-
   * De-Refs Single Pure virtual packages. Closes: #42437, #43555
   * Regexs for install. Closes: #35304, #38835
   * Dependency reports now show OR group relations
   * Re-Install feature. Cloes: #46961, #37393, #38919
+  * Locks archive directory on clean (woops)
   
  -- Jason Gunthorpe <jgg@debian.org>  Fri,  3 Sep 1999 09:04:28 -0700