- int hash_bytes = cf->head.hash_size * sizeof(int);
- if (lseek (cf->hash_fd, 0L, SEEK_SET) < 0)
- {
- logf (LOG_FATAL|LOG_ERRNO, "seek in hash fd");
- exit (1);
- }
- hash_write (cf, &cf->head, sizeof(cf->head));
- hash_write (cf, cf->array, hash_bytes);
- }
- if (close (cf->hash_fd) < 0)
- {
- logf (LOG_FATAL|LOG_ERRNO, "close hash fd");
- exit (1);
- }
- if (close (cf->block_fd) < 0)
- {
- logf (LOG_FATAL|LOG_ERRNO, "close block fd");
- exit (1);
+ mf_write (cf->hash_mf, 0, 0, sizeof(cf->head), &cf->head);
+ write_head (cf);