diff options
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-item.cc | 2 | ||||
-rw-r--r-- | apt-pkg/contrib/cdromutl.cc | 24 |
2 files changed, 22 insertions, 4 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 7257f89e4..2c4ce91a0 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1327,7 +1327,7 @@ void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) Status = StatTransientNetworkError; _error->Warning(_("A error occurred during the signature " "verification. The repository is not updated " - "and the previous index files will be used." + "and the previous index files will be used. " "GPG error: %s: %s\n"), Desc.Description.c_str(), LookupTag(Message,"Message").c_str()); diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index 6dce82fe1..68b980407 100644 --- a/apt-pkg/contrib/cdromutl.cc +++ b/apt-pkg/contrib/cdromutl.cc @@ -156,6 +156,19 @@ bool MountCdrom(string Path, string DeviceName) bool IdentCdrom(string CD,string &Res,unsigned int Version) { MD5Summation Hash; + bool writable_media = false; + + // if we are on a writable medium (like a usb-stick) that is just + // used like a cdrom don't use "." as it will constantly change, + // use .disk instead + if (access(CD.c_str(), W_OK) == 0 && DirectoryExists(CD+string("/.disk"))) + { + writable_media = true; + CD = CD.append("/.disk"); + if (_config->FindB("Debug::aptcdrom",false) == true) + std::clog << "Found writable cdrom, using alternative path: " << CD + << std::endl; + } string StartDir = SafeGetCWD(); if (chdir(CD.c_str()) != 0) @@ -202,10 +215,15 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version) struct statvfs Buf; if (statvfs(CD.c_str(),&Buf) != 0) return _error->Errno("statfs",_("Failed to stat the cdrom")); - + // We use a kilobyte block size to advoid overflow - sprintf(S,"%lu %lu",(long)(Buf.f_blocks*(Buf.f_bsize/1024)), - (long)(Buf.f_bfree*(Buf.f_bsize/1024))); + if (writable_media) + { + sprintf(S,"%lu",(long)(Buf.f_blocks*(Buf.f_bsize/1024))); + } else { + sprintf(S,"%lu %lu",(long)(Buf.f_blocks*(Buf.f_bsize/1024)), + (long)(Buf.f_bfree*(Buf.f_bsize/1024))); + } Hash.Add(S); sprintf(S,"-%u",Version); } |