| 76 | } |
| 77 | |
| 78 | static void process_log_file(void) |
| 79 | { |
| 80 | struct stat st; |
| 81 | if (fstat(get_lock_file_fd(&log_lock), &st)) { |
| 82 | /* |
| 83 | * Perhaps there was an i/o error or another |
| 84 | * unlikely situation. Try to make a note of |
| 85 | * this in gc.log along with any existing |
| 86 | * messages. |
| 87 | */ |
| 88 | int saved_errno = errno; |
| 89 | fprintf(stderr, _("Failed to fstat %s: %s"), |
| 90 | get_lock_file_path(&log_lock), |
| 91 | strerror(saved_errno)); |
| 92 | fflush(stderr); |
| 93 | commit_lock_file(&log_lock); |
| 94 | errno = saved_errno; |
| 95 | } else if (st.st_size) { |
| 96 | /* There was some error recorded in the lock file */ |
| 97 | commit_lock_file(&log_lock); |
| 98 | } else { |
| 99 | char *path = repo_git_path(the_repository, "gc.log"); |
| 100 | /* No error, clean up any old gc.log */ |
| 101 | unlink(path); |
| 102 | rollback_lock_file(&log_lock); |
| 103 | free(path); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | static void process_log_file_at_exit(void) |
| 108 | { |
no test coverage detected