Skip to content

Commit 6104867

Browse files
committed
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
2 parents 1ea1f93 + 5f2b643 commit 6104867

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

bugreport.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ int cmd_main(int argc, const char **argv)
180180
die(_("couldn't create a new file at '%s'"), report_path.buf);
181181
}
182182

183-
strbuf_write_fd(&buffer, report);
183+
if (write_in_full(report, buffer.buf, buffer.len) < 0)
184+
die_errno(_("unable to write to %s"), report_path.buf);
185+
184186
close(report);
185187

186188
/*

strbuf.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -556,11 +556,6 @@ ssize_t strbuf_write(struct strbuf *sb, FILE *f)
556556
return sb->len ? fwrite(sb->buf, 1, sb->len, f) : 0;
557557
}
558558

559-
ssize_t strbuf_write_fd(struct strbuf *sb, int fd)
560-
{
561-
return sb->len ? write(fd, sb->buf, sb->len) : 0;
562-
}
563-
564559
#define STRBUF_MAXLINK (2*PATH_MAX)
565560

566561
int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)

strbuf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,6 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint);
473473
* NUL bytes.
474474
*/
475475
ssize_t strbuf_write(struct strbuf *sb, FILE *stream);
476-
ssize_t strbuf_write_fd(struct strbuf *sb, int fd);
477476

478477
/**
479478
* Read a line from a FILE *, overwriting the existing contents of

0 commit comments

Comments
 (0)