summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-09-07 09:57:09 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-09-07 09:57:09 +0200
commit8deb53abcc5c22cdbd8b17e0db8b752c3d2783c8 (patch)
tree19d7c2f43424e2aa7bdebfeb160af9d65c251380 /apt-pkg
parent3d661e4aa122dedcf830062f34b1db18cb45fc59 (diff)
do not replace /dev/null when running in APT::CDROM::NoAct
mode (LP: #612666), thanks to Colin Watson
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/indexcopy.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index 0abbf63de..3156778d4 100644
--- a/apt-pkg/indexcopy.cc
+++ b/apt-pkg/indexcopy.cc
@@ -132,9 +132,14 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
(*I).c_str() + CDROM.length(),GetFileName());
string TargetF = _config->FindDir("Dir::State::lists") + "partial/";
TargetF += URItoFileName(S);
+ FileFd Target;
if (_config->FindB("APT::CDROM::NoAct",false) == true)
+ {
TargetF = "/dev/null";
- FileFd Target(TargetF,FileFd::WriteAtomic);
+ Target.Open(TargetF,FileFd::WriteExists);
+ } else {
+ Target.Open(TargetF,FileFd::WriteAtomic);
+ }
FILE *TargetFl = fdopen(dup(Target.Fd()),"w");
if (_error->PendingError() == true)
return false;