diff options
| author | Jeff King <peff@peff.net> | 2016-07-08 05:12:55 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2016-07-08 09:47:29 -0700 |
| commit | e78d5d49935373dabcc40c5e32aefe4956a70b97 (patch) | |
| tree | f2d9307ea64ca0b233b42e61031244076db39adc /builtin/am.c | |
| parent | e04d08a4b3373972717c805ae8e788219b873b2a (diff) | |
use write_file_buf where applicable
There are several places where we open a file, write some
content from a strbuf, and close it. These can be simplified
with write_file_buf(). As a bonus, many of these did not
catch write problems at close() time.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/am.c')
| -rw-r--r-- | builtin/am.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/builtin/am.c b/builtin/am.c index a974223876..5fdf5b4c24 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -402,13 +402,8 @@ static int read_commit_msg(struct am_state *state) */ static void write_commit_msg(const struct am_state *state) { - int fd; const char *filename = am_path(state, "final-commit"); - - fd = xopen(filename, O_WRONLY | O_CREAT, 0666); - if (write_in_full(fd, state->msg, state->msg_len) < 0) - die_errno(_("could not write to %s"), filename); - close(fd); + write_file_buf(filename, state->msg, state->msg_len); } /** |
