| 1318 | } |
| 1319 | |
| 1320 | static int write_file_in_place(const char *path, const struct strbuf *buf) |
| 1321 | { |
| 1322 | struct tempfile *tempfile = trailer_create_in_place_tempfile(path); |
| 1323 | if (!tempfile) |
| 1324 | return -1; |
| 1325 | |
| 1326 | if (write_in_full(tempfile->fd, buf->buf, buf->len) < 0) |
| 1327 | return error_errno(_("could not write to temporary file")); |
| 1328 | |
| 1329 | if (rename_tempfile(&tempfile, path)) |
| 1330 | return error_errno(_("could not rename temporary file to %s"), path); |
| 1331 | |
| 1332 | return 0; |
| 1333 | } |
| 1334 | |
| 1335 | int amend_file_with_trailers(const char *path, |
| 1336 | const struct strvec *trailer_args) |
no test coverage detected