diff options
Diffstat (limited to 'ssh-upload.c')
-rw-r--r-- | ssh-upload.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/ssh-upload.c b/ssh-upload.c index 901e0366df..86b169bf4f 100644 --- a/ssh-upload.c +++ b/ssh-upload.c @@ -21,17 +21,14 @@ static int serve_object(int fd_in, int fd_out) { ssize_t size; unsigned char sha1[20]; signed char remote; - int posn = 0; - do { - size = read(fd_in, sha1 + posn, 20 - posn); - if (size < 0) { - perror("git-ssh-upload: read "); - return -1; - } - if (!size) - return -1; - posn += size; - } while (posn < 20); + + size = read_in_full(fd_in, sha1, 20); + if (size < 0) { + perror("git-ssh-upload: read "); + return -1; + } + if (!size) + return -1; if (verbose) fprintf(stderr, "Serving %s\n", sha1_to_hex(sha1)); @@ -54,7 +51,7 @@ static int serve_object(int fd_in, int fd_out) { static int serve_version(int fd_in, int fd_out) { - if (read(fd_in, &remote_version, 1) < 1) + if (xread(fd_in, &remote_version, 1) < 1) return -1; write(fd_out, &local_version, 1); return 0; @@ -67,7 +64,7 @@ static int serve_ref(int fd_in, int fd_out) int posn = 0; signed char remote = 0; do { - if (posn >= PATH_MAX || read(fd_in, ref + posn, 1) < 1) + if (posn >= PATH_MAX || xread(fd_in, ref + posn, 1) < 1) return -1; posn++; } while (ref[posn - 1]); @@ -89,7 +86,7 @@ static void service(int fd_in, int fd_out) { char type; int retval; do { - retval = read(fd_in, &type, 1); + retval = xread(fd_in, &type, 1); if (retval < 1) { if (retval < 0) perror("git-ssh-upload: read "); |