aboutsummaryrefslogtreecommitdiff
path: root/write-or-die.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-03-13 07:45:17 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-13 08:54:14 -0700
commit1970fcef93adcc5a35f6468d00a5a634d5af2b3c (patch)
tree72a7d14cd6856beff59ccdf49a71dcda0066f06a /write-or-die.c
parent3b9b2c2a29a1d529ca9884fa0a6529f6e2496abe (diff)
downloadgit-1970fcef93adcc5a35f6468d00a5a634d5af2b3c.tar.xz
wrapper: introduce writev(3p) wrappers
In the preceding commit we have added a compatibility wrapper for the writev(3p) syscall. Introduce some generic wrappers for this function that we nowadays take for granted in the Git codebase. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'write-or-die.c')
-rw-r--r--write-or-die.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/write-or-die.c b/write-or-die.c
index 01a9a51fa2..5f522fb728 100644
--- a/write-or-die.c
+++ b/write-or-die.c
@@ -96,6 +96,14 @@ void write_or_die(int fd, const void *buf, size_t count)
}
}
+void writev_or_die(int fd, struct iovec *iov, int iovlen)
+{
+ if (writev_in_full(fd, iov, iovlen) < 0) {
+ check_pipe(errno);
+ die_errno("writev error");
+ }
+}
+
void fwrite_or_die(FILE *f, const void *buf, size_t count)
{
if (fwrite(buf, 1, count, f) != count)