-+/* The len count is the length of the basename + 1 for the null. */
-+static void add_checksum(const char *dirname, const char *basename, int len,
-+ OFF_T file_length, time_t mtime, const char *sum,
-+ int flags)
-+{
-+ struct file_struct *file;
-+ int alloc_len, extra_len;
-+ char *bp;
-+
-+ if (len == 8+1 && *basename == '.'
-+ && (strcmp(basename, ".md5sums") == 0
-+ || strcmp(basename, ".md4sums") == 0))
-+ return;
-+
-+ if (len < 0)
-+ len = strlen(basename) + 1;
-+
-+ extra_len = (file_extra_cnt + (file_length > 0xFFFFFFFFu) + SUM_EXTRA_CNT)
-+ * EXTRA_LEN;
-+#if EXTRA_ROUNDING > 0
-+ if (extra_len & (EXTRA_ROUNDING * EXTRA_LEN))
-+ extra_len = (extra_len | (EXTRA_ROUNDING * EXTRA_LEN)) + EXTRA_LEN;
-+#endif
-+ alloc_len = FILE_STRUCT_LEN + extra_len + len;
-+ bp = pool_alloc(checksum_flist->file_pool, alloc_len, "add_checksum");
-+
-+ memset(bp, 0, extra_len + FILE_STRUCT_LEN);
-+ bp += extra_len;
-+ file = (struct file_struct *)bp;
-+ bp += FILE_STRUCT_LEN;
-+
-+ memcpy(bp, basename, len);
-+
-+ file->flags = flags;
-+ file->mode = S_IFREG;
-+ file->modtime = mtime;
-+ file->len32 = (uint32)file_length;
-+ if (file_length > 0xFFFFFFFFu) {
-+ file->flags |= FLAG_LENGTH64;
-+ OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32);
+ /* The len count is the length of the basename + 1 for the null. */
+ static int add_checksum(const char *dirname, const char *basename, int len,
+- OFF_T file_length, time_t mtime, const char *sum)
++ OFF_T file_length, time_t mtime, int32 ctime, int32 inode,
++ const char *sum, const char *alt_sum, int flags)
+ {
+ struct file_struct *file;
+ int alloc_len, extra_len;
+@@ -328,13 +337,14 @@ static int add_checksum(const char *dirname, const char *basename, int len,
+ if (file_length == 0)
+ return 0;
+
+- extra_len = (file_extra_cnt + (file_length > 0xFFFFFFFFu) + SUM_EXTRA_CNT)
++ /* "2" is for a 32-bit ctime num and an 32-bit inode num. */
++ extra_len = (file_extra_cnt + (file_length > 0xFFFFFFFFu) + SUM_EXTRA_CNT + 2)
+ * EXTRA_LEN;
+ #if EXTRA_ROUNDING > 0
+ if (extra_len & (EXTRA_ROUNDING * EXTRA_LEN))
+ extra_len = (extra_len | (EXTRA_ROUNDING * EXTRA_LEN)) + EXTRA_LEN;
+ #endif
+- alloc_len = FILE_STRUCT_LEN + extra_len + len;
++ alloc_len = FILE_STRUCT_LEN + extra_len + len + checksum_len*2 + 1;
+ bp = pool_alloc(checksum_flist->file_pool, alloc_len, "add_checksum");
+
+ memset(bp, 0, extra_len + FILE_STRUCT_LEN);
+@@ -343,7 +353,14 @@ static int add_checksum(const char *dirname, const char *basename, int len,
+ bp += FILE_STRUCT_LEN;
+
+ memcpy(bp, basename, len);
++ if (alt_sum)
++ strlcpy(bp+len, alt_sum, checksum_len*2 + 1);
++ else {
++ memset(bp+len, '=', checksum_len*2);
++ bp[len+checksum_len*2] = '\0';