X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=write_or_die.c;h=4c29255df1b637f93ab3d59e0dcab1fa3b40e10b;hb=2944e4e6145bdfcb1a8730d7da671786d72c86ed;hp=e4c8e225fd232dfd642aa13d7ae5b64b9827c915;hpb=547905f8cd2a04b3e1117f00025b60f81aa60f47;p=git.git diff --git a/write_or_die.c b/write_or_die.c index e4c8e225f..4c29255df 100644 --- a/write_or_die.c +++ b/write_or_die.c @@ -45,44 +45,6 @@ void maybe_flush_or_die(FILE *f, const char *desc) } } -ssize_t read_in_full(int fd, void *buf, size_t count) -{ - char *p = buf; - ssize_t total = 0; - - while (count > 0) { - ssize_t loaded = xread(fd, p, count); - if (loaded <= 0) - return total ? total : loaded; - count -= loaded; - p += loaded; - total += loaded; - } - - return total; -} - -ssize_t write_in_full(int fd, const void *buf, size_t count) -{ - const char *p = buf; - ssize_t total = 0; - - while (count > 0) { - ssize_t written = xwrite(fd, p, count); - if (written < 0) - return -1; - if (!written) { - errno = ENOSPC; - return -1; - } - count -= written; - p += written; - total += written; - } - - return total; -} - void fsync_or_die(int fd, const char *msg) { if (fsync(fd) < 0) {