diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-06-29 14:17:26 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-06-29 14:17:26 -0700 |
commit | 610486749aca4ce9e5923baa70b072eff69a9867 (patch) | |
tree | 1f3e76a1110c6f5aa1ead924e09dc6cd63dc1dd7 | |
parent | Merge branch 'dl/diff-usage-comment-update' (diff) | |
parent | strbuf: remove unreferenced strbuf_write_fd method. (diff) | |
download | tgif-610486749aca4ce9e5923baa70b072eff69a9867.tar.xz |
Merge branch 'rs/retire-strbuf-write-fd'
A misdesigned strbuf_write_fd() function has been retired.
* rs/retire-strbuf-write-fd:
strbuf: remove unreferenced strbuf_write_fd method.
bugreport.c: replace strbuf_write_fd with write_in_full
-rw-r--r-- | bugreport.c | 4 | ||||
-rw-r--r-- | strbuf.c | 5 | ||||
-rw-r--r-- | strbuf.h | 1 |
3 files changed, 3 insertions, 7 deletions
diff --git a/bugreport.c b/bugreport.c index 28f4568b01..09579e268d 100644 --- a/bugreport.c +++ b/bugreport.c @@ -180,7 +180,9 @@ int cmd_main(int argc, const char **argv) die(_("couldn't create a new file at '%s'"), report_path.buf); } - strbuf_write_fd(&buffer, report); + if (write_in_full(report, buffer.buf, buffer.len) < 0) + die_errno(_("unable to write to %s"), report_path.buf); + close(report); /* @@ -556,11 +556,6 @@ ssize_t strbuf_write(struct strbuf *sb, FILE *f) return sb->len ? fwrite(sb->buf, 1, sb->len, f) : 0; } -ssize_t strbuf_write_fd(struct strbuf *sb, int fd) -{ - return sb->len ? write(fd, sb->buf, sb->len) : 0; -} - #define STRBUF_MAXLINK (2*PATH_MAX) int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint) @@ -473,7 +473,6 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint); * NUL bytes. */ ssize_t strbuf_write(struct strbuf *sb, FILE *stream); -ssize_t strbuf_write_fd(struct strbuf *sb, int fd); /** * Read a line from a FILE *, overwriting the existing contents of |