Refactor handling of error_string in receive-pack
[gitweb.git] / write_or_die.c
index 4e8183e93e88e7336baed561b026b702b9dcba4e..5c4bc8515ab9484131de7e065e08657315004f8c 100644 (file)
@@ -17,25 +17,13 @@ int read_in_full(int fd, void *buf, size_t count)
        return total;
 }
 
-void read_or_die(int fd, void *buf, size_t count)
-{
-       ssize_t loaded;
-
-       loaded = read_in_full(fd, buf, count);
-       if (loaded != count) {
-               if (loaded < 0)
-                       die("read error (%s)", strerror(errno));
-               die("read error: end of file");
-       }
-}
-
 int write_in_full(int fd, const void *buf, size_t count)
 {
        const char *p = buf;
        ssize_t total = 0;
 
        while (count > 0) {
-               size_t written = xwrite(fd, p, count);
+               ssize_t written = xwrite(fd, p, count);
                if (written < 0)
                        return -1;
                if (!written) {