summaryrefslogtreecommitdiff
path: root/ftparchive/writer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ftparchive/writer.cc')
-rw-r--r--ftparchive/writer.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc
index 58e32dade..d7d699ddc 100644
--- a/ftparchive/writer.cc
+++ b/ftparchive/writer.cc
@@ -708,18 +708,21 @@ bool SourcesWriter::DoPackage(string FileName)
// Add the dsc to the files hash list
string const strippedName = flNotDir(FileName);
std::ostringstream ostreamFiles;
- ostreamFiles << "\n " << string(MD5.Result()) << " " << St.st_size << " "
- << strippedName << "\n " << Tags.FindS("Files");
+ if (Tags.Exists("Files"))
+ ostreamFiles << "\n " << string(MD5.Result()) << " " << St.st_size << " "
+ << strippedName << "\n " << Tags.FindS("Files");
string const Files = ostreamFiles.str();
std::ostringstream ostreamSha1;
- ostreamSha1 << "\n " << string(SHA1.Result()) << " " << St.st_size << " "
- << strippedName << "\n " << Tags.FindS("Checksums-Sha1");
+ if (Tags.Exists("Checksums-Sha1"))
+ ostreamSha1 << "\n " << string(SHA1.Result()) << " " << St.st_size << " "
+ << strippedName << "\n " << Tags.FindS("Checksums-Sha1");
string const ChecksumsSha1 = ostreamSha1.str();
std::ostringstream ostreamSha256;
- ostreamSha256 << "\n " << string(SHA256.Result()) << " " << St.st_size << " "
- << strippedName << "\n " << Tags.FindS("Checksums-Sha256");
+ if (Tags.Exists("Checksums-Sha256"))
+ ostreamSha256 << "\n " << string(SHA256.Result()) << " " << St.st_size << " "
+ << strippedName << "\n " << Tags.FindS("Checksums-Sha256");
string const ChecksumsSha256 = ostreamSha256.str();
// Strip the DirStrip prefix from the FileName and add the PathPrefix
@@ -925,12 +928,12 @@ ReleaseWriter::ReleaseWriter(string const &DB)
}
time_t const validuntil = now + _config->FindI("APT::FTPArchive::Release::ValidTime", 0);
- char validstr[128] = "";
+ char validstr[128];
if (now == validuntil ||
strftime(validstr, sizeof(validstr), "%a, %d %b %Y %H:%M:%S UTC",
gmtime(&validuntil)) == 0)
{
- datestr[0] = '\0';
+ validstr[0] = '\0';
}
map<string,string> Fields;