X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/9bd2313a5c7523501bcec398877489c5a1fc1415..ece81b7517b1af6f86aff733498f6c11d5aa814f:/methods/store.cc diff --git a/methods/store.cc b/methods/store.cc index 29cf9e947..fa02d4597 100644 --- a/methods/store.cc +++ b/methods/store.cc @@ -14,7 +14,6 @@ #include #include -#include #include #include #include @@ -73,7 +72,7 @@ bool StoreMethod::Fetch(FetchItem *Itm) /*{{{*/ { if (OpenFileWithCompressorByName(From, Path, FileFd::ReadOnly, Prog) == false) return false; - if(From.FileSize() == 0) + if(From.IsCompressed() && From.FileSize() == 0) return _error->Error(_("Empty files can't be valid archives")); } else @@ -127,20 +126,8 @@ bool StoreMethod::Fetch(FetchItem *Itm) /*{{{*/ if (Failed == true) return false; - // Transfer the modification times - if (Itm->DestFile != "/dev/null") - { - struct stat Buf; - if (stat(Path.c_str(),&Buf) != 0) - return _error->Errno("stat",_("Failed to stat")); - - struct timeval times[2]; - times[0].tv_sec = Buf.st_atime; - Res.LastModified = times[1].tv_sec = Buf.st_mtime; - times[0].tv_usec = times[1].tv_usec = 0; - if (utimes(Itm->DestFile.c_str(), times) != 0) - return _error->Errno("utimes",_("Failed to set modification time")); - } + if (TransferModificationTimes(Path.c_str(), Itm->DestFile.c_str(), Res.LastModified) == false) + return false; // Return a Done response Res.TakeHashes(Hash); @@ -152,8 +139,5 @@ bool StoreMethod::Fetch(FetchItem *Itm) /*{{{*/ int main(int, char *argv[]) { - setlocale(LC_ALL, ""); - - StoreMethod Mth(flNotDir(argv[0])); - return Mth.Run(); + return StoreMethod(flNotDir(argv[0])).Run(); }