diff options
Diffstat (limited to 'ftparchive')
-rw-r--r-- | ftparchive/apt-ftparchive.cc | 2 | ||||
-rw-r--r-- | ftparchive/contents.cc | 2 | ||||
-rw-r--r-- | ftparchive/multicompress.cc | 13 | ||||
-rw-r--r-- | ftparchive/override.cc | 58 |
4 files changed, 35 insertions, 40 deletions
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index 2639bc2f6..712f8469a 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -864,7 +864,7 @@ bool Generate(CommandLine &CmdL) unsigned long MaxContentsChange = Setup.FindI("Default::MaxContentsChange",UINT_MAX)*1024; for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I) { - // This record is not relevent + // This record is not relevant if (I->ContentsDone == true || I->Contents.empty() == true) continue; diff --git a/ftparchive/contents.cc b/ftparchive/contents.cc index 015c790e0..80fe6e17e 100644 --- a/ftparchive/contents.cc +++ b/ftparchive/contents.cc @@ -233,7 +233,7 @@ void GenContents::Add(const char *Dir,const char *Package) // The final component if it does not have a trailing / if (I - Start >= 1) - Root = Grab(Root,Start,Package); + Grab(Root,Start,Package); } /*}}}*/ // GenContents::WriteSpace - Write a given number of white space chars /*{{{*/ diff --git a/ftparchive/multicompress.cc b/ftparchive/multicompress.cc index 1fea589e2..1555d2f2d 100644 --- a/ftparchive/multicompress.cc +++ b/ftparchive/multicompress.cc @@ -21,9 +21,10 @@ #include <apt-pkg/error.h> #include <apt-pkg/md5.h> +#include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> -#include <utime.h> +#include <sys/time.h> #include <unistd.h> #include <iostream> @@ -234,14 +235,12 @@ bool MultiCompress::Finalize(unsigned long long &OutSize) else { // Update the mtime if necessary - if (UpdateMTime > 0 && + if (UpdateMTime > 0 && (Now - St.st_mtime > (signed)UpdateMTime || St.st_mtime > Now)) { - struct utimbuf Buf; - Buf.actime = Buf.modtime = Now; - utime(I->Output.c_str(),&Buf); + utimes(I->Output.c_str(), NULL); Changed = true; - } + } } // Force the file permissions @@ -367,7 +366,7 @@ bool MultiCompress::Child(int const &FD) for (Files *I = Outputs; I != 0; I = I->Next) { // Set the correct file modes - fchmod(I->TmpFile.Fd(),Permissions); + chmod(I->TmpFile.Name().c_str(),Permissions); if (rename(I->TmpFile.Name().c_str(),I->Output.c_str()) != 0) _error->Errno("rename",_("Failed to rename %s to %s"), diff --git a/ftparchive/override.cc b/ftparchive/override.cc index 760c20120..d2130db8a 100644 --- a/ftparchive/override.cc +++ b/ftparchive/override.cc @@ -49,48 +49,44 @@ bool Override::ReadOverride(string const &File,bool const &Source) // Strip space leading up to the package name, skip blank lines char *Pkg = Line; for (; isspace(*Pkg) && *Pkg != 0;Pkg++); - if (Pkg == 0) + if (*Pkg == 0) continue; +#define APT_FIND_NEXT_FIELD \ + for (End++; isspace(*End) != 0 && *End != 0; ++End) \ + /* skip spaces */ ; \ + Start = End; \ + for (; isspace(*End) == 0 && *End != 0; ++End) \ + /* find end of word */ ; + +#define APT_WARNING_MALFORMED_LINE(FIELD) \ + if (*End == 0) \ + { \ + _error->Warning(_("Malformed override %s line %llu (%s)"),File.c_str(), \ + Counter, FIELD ); \ + continue; \ + } \ + *End = 0; + // Find the package and zero.. - char *Start = Pkg; + char *Start; char *End = Pkg; for (; isspace(*End) == 0 && *End != 0; End++); - if (*End == 0) - { - _error->Warning(_("Malformed override %s line %llu #1"),File.c_str(), - Counter); - continue; - } - *End = 0; + APT_WARNING_MALFORMED_LINE("pkgname"); + + APT_FIND_NEXT_FIELD; // Find the priority if (Source == false) { - for (End++; isspace(*End) != 0 && *End != 0; End++); - Start = End; - for (; isspace(*End) == 0 && *End != 0; End++); - if (*End == 0) - { - _error->Warning(_("Malformed override %s line %llu #2"),File.c_str(), - Counter); - continue; - } - *End = 0; + APT_WARNING_MALFORMED_LINE("priority"); Itm.Priority = Start; + + APT_FIND_NEXT_FIELD; } - + // Find the Section - for (End++; isspace(*End) != 0 && *End != 0; End++); - Start = End; - for (; isspace(*End) == 0 && *End != 0; End++); - if (*End == 0) - { - _error->Warning(_("Malformed override %s line %llu #3"),File.c_str(), - Counter); - continue; - } - *End = 0; + APT_WARNING_MALFORMED_LINE("section"); Itm.FieldOverride["Section"] = Start; // Source override files only have the two columns @@ -99,7 +95,7 @@ bool Override::ReadOverride(string const &File,bool const &Source) Mapping[Pkg] = Itm; continue; } - + // Find the => for (End++; isspace(*End) != 0 && *End != 0; End++); if (*End != 0) |