Use hashcpy() when copying object names
[gitweb.git] / pack-write.c
index ddc174e1adb9e1545b2815d8a1990e43f6fa2bfb..9b8308b7594263c4900a6d75c18b91cea959fd70 100644 (file)
@@ -183,8 +183,7 @@ off_t write_pack_header(struct sha1file *f, uint32_t nr_entries)
        hdr.hdr_signature = htonl(PACK_SIGNATURE);
        hdr.hdr_version = htonl(PACK_VERSION);
        hdr.hdr_entries = htonl(nr_entries);
-       if (sha1write(f, &hdr, sizeof(hdr)))
-               return 0;
+       sha1write(f, &hdr, sizeof(hdr));
        return sizeof(hdr);
 }
 
@@ -365,5 +364,7 @@ void finish_tmp_packfile(char *name_buffer,
        if (rename(idx_tmp_name, name_buffer))
                die_errno("unable to rename temporary index file");
 
+       *end_of_name_prefix = '\0';
+
        free((void *)idx_tmp_name);
 }