summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
Diffstat (limited to 'methods')
-rw-r--r--methods/cdrom.cc10
-rw-r--r--methods/connect.cc3
-rw-r--r--methods/file.cc8
3 files changed, 18 insertions, 3 deletions
diff --git a/methods/cdrom.cc b/methods/cdrom.cc
index 7cc036814..d6b8eae75 100644
--- a/methods/cdrom.cc
+++ b/methods/cdrom.cc
@@ -13,6 +13,7 @@
#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/hashes.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -165,8 +166,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
if (MediaFail(Get.Host,CDROM) == false)
{
CurrentID = "FAIL";
- Fail(_("Wrong CD-ROM"),true);
- return true;
+ return _error->Error(_("Disk not found."));
}
}
@@ -180,6 +180,12 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
CurrentID = NewID;
Res.LastModified = Buf.st_mtime;
Res.Size = Buf.st_size;
+
+ Hashes Hash;
+ FileFd Fd(Res.Filename, FileFd::ReadOnly);
+ Hash.AddFD(Fd.Fd(), Fd.Size());
+ Res.TakeHashes(Hash);
+
URIDone(Res);
return true;
}
diff --git a/methods/connect.cc b/methods/connect.cc
index b85df6887..4e48927ed 100644
--- a/methods/connect.cc
+++ b/methods/connect.cc
@@ -166,8 +166,11 @@ bool Connect(string Host,int Port,const char *Service,int DefPort,int &Fd,
}
if (Res == EAI_AGAIN)
+ {
+ Owner->SetFailExtraMsg("\nFailReason: TmpResolveFailure");
return _error->Error(_("Temporary failure resolving '%s'"),
Host.c_str());
+ }
return _error->Error(_("Something wicked happened resolving '%s:%s' (%i)"),
Host.c_str(),ServStr,Res);
}
diff --git a/methods/file.cc b/methods/file.cc
index 3500de9f5..9cdd5bc2d 100644
--- a/methods/file.cc
+++ b/methods/file.cc
@@ -15,6 +15,8 @@
// Include Files /*{{{*/
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/hashes.h>
+#include <apt-pkg/fileutl.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -75,7 +77,11 @@ bool FileMethod::Fetch(FetchItem *Itm)
if (Res.Filename.empty() == true)
return _error->Error(_("File not found"));
-
+
+ Hashes Hash;
+ FileFd Fd(Res.Filename, FileFd::ReadOnly);
+ Hash.AddFD(Fd.Fd(), Fd.Size());
+ Res.TakeHashes(Hash);
URIDone(Res);
return true;
}