From 63911718ee6d1c4c25d70c710d1d80e7747bb103 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Wed, 30 Mar 2005 20:20:06 +0000 Subject: Added warnings if duplicate md5s are found, as suggested in bug report #1167146 svn-id: r17299 --- tools/md5table.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/md5table.c b/tools/md5table.c index ef1e714385..78b0c18963 100644 --- a/tools/md5table.c +++ b/tools/md5table.c @@ -264,9 +264,17 @@ int main(int argc, char *argv[]) fprintf(outFile, c_header, generationDate); /* Now sort the MD5 table (this allows for binary searches) */ qsort(entriesBuffer, numEntries, entrySize, strcmp_wrapper); - /* Output the table */ - for (i = 0; i < numEntries; ++i) - fprintf(outFile, entriesBuffer + i * entrySize); + /* Output the table and emit warnings if duplicate md5s are found */ + buffer[0] = '\0'; + for (i = 0; i < numEntries; ++i) { + const char *currentEntry = entriesBuffer + i * entrySize; + fprintf(outFile, currentEntry); + if (strncmp(currentEntry + 4, buffer, 32) == 0) { + warning("Duplicate MD5 found '%.32s'", buffer); + } else { + strncpy(buffer, currentEntry + 4, 32); + } + } /* Finally, print the footer */ fprintf(outFile, c_footer); } -- cgit v1.2.3