git-daemon: actually remember the children we have outstanding
[gitweb.git] / tar-tree.c
index ccc39c92a0416fa12a1e261b4a147139dc710b2c..673ac66ed6fd37eeeaa8580b2e43f0e2cee91a16 100644 (file)
@@ -73,16 +73,13 @@ static char *get_record(void)
  */
 static void write_trailer(void)
 {
-       memset(block + offset, 0, RECORDSIZE);
-       offset += RECORDSIZE;
+       get_record();
        write_if_needed();
-       memset(block + offset, 0, RECORDSIZE);
-       offset += RECORDSIZE;
+       get_record();
        write_if_needed();
-       if (offset) {
-               memset(block + offset, 0, BLOCKSIZE - offset);
-               reliable_write(block, BLOCKSIZE);
-               offset = 0;
+       while (offset) {
+               get_record();
+               write_if_needed();
        }
 }
 
@@ -375,7 +372,7 @@ static void traverse_tree(void *buffer, unsigned long size,
 }
 
 /* get commit time from committer line of commit object */
-time_t commit_time(void * buffer, unsigned long size)
+static time_t commit_time(void * buffer, unsigned long size)
 {
        time_t result = 0;
        char *p = buffer;
@@ -433,8 +430,8 @@ int main(int argc, char **argv)
        if (!archive_time)
                archive_time = time(NULL);
        if (basedir)
-               write_header("0", TYPEFLAG_DIR, NULL, NULL, basedir, 040755,
-                            NULL, 0);
+               write_header((unsigned char *)"0", TYPEFLAG_DIR, NULL, NULL,
+                       basedir, 040755, NULL, 0);
        traverse_tree(buffer, size, NULL);
        free(buffer);
        write_trailer();