aboutsummaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@lfos.de>2016-06-14 16:49:17 +0200
committerJunio C Hamano <gitster@pobox.com>2016-06-16 11:40:31 -0700
commitfcf0fe9e698b7ec3de4e8565030886fc4e4a2757 (patch)
treece7b534302bd5bb6cae4d24471c53ceaa3d6ed1c /upload-pack.c
parent4c4b7d1d3b5be12ad83d0ecfc537b40af37462c9 (diff)
downloadgit-fcf0fe9e698b7ec3de4e8565030886fc4e4a2757.tar.gz
git-fcf0fe9e698b7ec3de4e8565030886fc4e4a2757.tar.xz
upload-pack.c: make send_client_data() return void
The send_client_data() function uses write_or_die() for writing data which immediately terminates the process on errors. If no such error occurred, send_client_data() always returned the value that was passed as third parameter prior to this commit. This value is already known to the caller in any case, so let's turn send_client_data() into a void function instead. Signed-off-by: Lukas Fleischer <lfleischer@lfos.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/upload-pack.c b/upload-pack.c
index f9d641060..44d63fba4 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -58,11 +58,11 @@ static void reset_timeout(void)
alarm(timeout);
}
-static ssize_t send_client_data(int fd, const char *data, ssize_t sz)
+static void send_client_data(int fd, const char *data, ssize_t sz)
{
if (use_sideband) {
send_sideband(1, fd, data, sz, use_sideband);
- return sz;
+ return;
}
if (fd == 3)
/* emergency quit */
@@ -70,10 +70,9 @@ static ssize_t send_client_data(int fd, const char *data, ssize_t sz)
if (fd == 2) {
/* XXX: are we happy to lose stuff here? */
xwrite(fd, data, sz);
- return sz;
+ return;
}
write_or_die(fd, data, sz);
- return sz;
}
static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
@@ -231,9 +230,7 @@ static void create_pack_file(void)
}
else
buffered = -1;
- sz = send_client_data(1, data, sz);
- if (sz < 0)
- goto fail;
+ send_client_data(1, data, sz);
}
/*
@@ -260,9 +257,7 @@ static void create_pack_file(void)
/* flush the data */
if (0 <= buffered) {
data[0] = buffered;
- sz = send_client_data(1, data, 1);
- if (sz < 0)
- goto fail;
+ send_client_data(1, data, 1);
fprintf(stderr, "flushed.\n");
}
if (use_sideband)