From c1cd1ac2fd051a11ec5c3eafad68b39521594ed6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 5 Aug 2012 14:16:24 +0200 Subject: * apt-pkg/cdrom.cc: - do not link() but rename() the cdroms.list to cdroms.list~ as a backup to ensure that apt-cdrom can be run multiple times (Closes: #676302) --- apt-pkg/cdrom.cc | 4 ++-- debian/changelog | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 8462e8286..699f66fb3 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -413,8 +413,8 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf) Out.close(); - if (FileExists(DFile) == true && link(DFile.c_str(),string(DFile + '~').c_str()) != 0) - return _error->Errno("link", "Failed to link %s to %s~", DFile.c_str(), DFile.c_str()); + if (FileExists(DFile) == true) + rename(DFile.c_str(), string(DFile + '~').c_str()); if (rename(NewFile.c_str(),DFile.c_str()) != 0) return _error->Errno("rename","Failed to rename %s.new to %s", DFile.c_str(),DFile.c_str()); diff --git a/debian/changelog b/debian/changelog index 7092d8164..3bed49ec0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -29,6 +29,9 @@ apt (0.9.7.4) UNRELEASED; urgency=low * apt-pkg/indexcopy.cc: - do not use atomic writing if the target is /dev/null as we don't want to replace it, not even automically. (Closes: #683410) + * apt-pkg/cdrom.cc: + - do not link() but rename() the cdroms.list to cdroms.list~ as a backup + to ensure that apt-cdrom can be run multiple times (Closes: #676302) -- David Kalnischkies Wed, 18 Jul 2012 11:45:57 +0200 -- cgit v1.2.3