summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
Diffstat (limited to 'methods')
-rw-r--r--methods/bzip2.cc5
-rw-r--r--methods/copy.cc2
-rw-r--r--methods/gpgv.cc2
-rw-r--r--methods/gzip.cc2
-rw-r--r--methods/http.cc10
-rw-r--r--methods/rred.cc4
6 files changed, 15 insertions, 10 deletions
diff --git a/methods/bzip2.cc b/methods/bzip2.cc
index 5da214bfc..241f21c66 100644
--- a/methods/bzip2.cc
+++ b/methods/bzip2.cc
@@ -91,7 +91,7 @@ bool Bzip2Method::Fetch(FetchItem *Itm)
close(GzOut[1]);
FileFd FromGz(GzOut[0]); // For autoclose
- FileFd To(Itm->DestFile,FileFd::WriteEmpty);
+ FileFd To(Itm->DestFile,FileFd::WriteAtomic);
To.EraseOnFailure();
if (_error->PendingError() == true)
return false;
@@ -102,9 +102,8 @@ bool Bzip2Method::Fetch(FetchItem *Itm)
while (1)
{
unsigned char Buffer[4*1024];
- unsigned long Count;
- Count = read(GzOut[0],Buffer,sizeof(Buffer));
+ ssize_t Count = read(GzOut[0],Buffer,sizeof(Buffer));
if (Count < 0 && errno == EINTR)
continue;
diff --git a/methods/copy.cc b/methods/copy.cc
index 027b59f46..a6bb372a3 100644
--- a/methods/copy.cc
+++ b/methods/copy.cc
@@ -52,7 +52,7 @@ bool CopyMethod::Fetch(FetchItem *Itm)
// See if the file exists
FileFd From(File,FileFd::ReadOnly);
- FileFd To(Itm->DestFile,FileFd::WriteEmpty);
+ FileFd To(Itm->DestFile,FileFd::WriteAtomic);
To.EraseOnFailure();
if (_error->PendingError() == true)
{
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index 018e4f622..efe1f73f7 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -69,7 +69,7 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
{
// TRANSLATOR: %s is the trusted keyring parts directory
ioprintf(ret, _("No keyring installed in %s."),
- _config->FindDir("Dir::Etc::TrustedParts", "/etc/apt/trusted.gpg.d").c_str());
+ _config->FindDir("Dir::Etc::TrustedParts").c_str());
return ret.str();
}
exit(111);
diff --git a/methods/gzip.cc b/methods/gzip.cc
index 72e3ac909..5b9b66b50 100644
--- a/methods/gzip.cc
+++ b/methods/gzip.cc
@@ -55,7 +55,7 @@ bool GzipMethod::Fetch(FetchItem *Itm)
return true;
}
- FileFd To(Itm->DestFile,FileFd::WriteEmpty);
+ FileFd To(Itm->DestFile,FileFd::WriteAtomic);
To.EraseOnFailure();
if (_error->PendingError() == true)
return false;
diff --git a/methods/http.cc b/methods/http.cc
index 9fa74bffa..25e31de9a 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -553,8 +553,14 @@ bool ServerState::HeaderLine(string Line)
// Evil servers return no version
if (Line[4] == '/')
{
- if (sscanf(Line.c_str(),"HTTP/%u.%u %u%[^\n]",&Major,&Minor,
- &Result,Code) != 4)
+ int const elements = sscanf(Line.c_str(),"HTTP/%u.%u %u%[^\n]",&Major,&Minor,&Result,Code);
+ if (elements == 3)
+ {
+ Code[0] = '\0';
+ if (Debug == true)
+ clog << "HTTP server doesn't give Reason-Phrase for " << Result << std::endl;
+ }
+ else if (elements != 4)
return _error->Error(_("The HTTP server sent an invalid reply header"));
}
else
diff --git a/methods/rred.cc b/methods/rred.cc
index f42c7a072..d51c45c85 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -446,7 +446,7 @@ bool RredMethod::Fetch(FetchItem *Itm) /*{{{*/
// the cleanup/closing of the fds)
FileFd From(Path,FileFd::ReadOnly);
FileFd Patch(Path+".ed",FileFd::ReadOnly);
- FileFd To(Itm->DestFile,FileFd::WriteEmpty);
+ FileFd To(Itm->DestFile,FileFd::WriteAtomic);
To.EraseOnFailure();
if (_error->PendingError() == true)
return false;
@@ -458,7 +458,7 @@ bool RredMethod::Fetch(FetchItem *Itm) /*{{{*/
// retry with patchFile
lseek(Patch.Fd(), 0, SEEK_SET);
lseek(From.Fd(), 0, SEEK_SET);
- To.Open(Itm->DestFile,FileFd::WriteEmpty);
+ To.Open(Itm->DestFile,FileFd::WriteAtomic);
if (_error->PendingError() == true)
return false;
if (patchFile(Patch, From, To, &Hash) != ED_OK) {