| 141 | } |
| 142 | |
| 143 | int read_mailmap_file(struct string_list *map, const char *filename, |
| 144 | unsigned flags) |
| 145 | { |
| 146 | char buffer[1024]; |
| 147 | FILE *f; |
| 148 | int fd; |
| 149 | |
| 150 | if (!filename) |
| 151 | return 0; |
| 152 | |
| 153 | if (flags & MAILMAP_NOFOLLOW) |
| 154 | fd = open_nofollow(filename, O_RDONLY); |
| 155 | else |
| 156 | fd = open(filename, O_RDONLY); |
| 157 | |
| 158 | if (fd < 0) { |
| 159 | if (errno == ENOENT) |
| 160 | return 0; |
| 161 | return error_errno("unable to open mailmap at %s", filename); |
| 162 | } |
| 163 | f = xfdopen(fd, "r"); |
| 164 | |
| 165 | while (fgets(buffer, sizeof(buffer), f) != NULL) |
| 166 | read_mailmap_line(map, buffer); |
| 167 | fclose(f); |
| 168 | return 0; |
| 169 | } |
| 170 | |
| 171 | static void read_mailmap_string(struct string_list *map, char *buf) |
| 172 | { |
no test coverage detected