Skip to content

Commit fcf0fe9

Browse files
lfosgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4c4b7d1 commit fcf0fe9

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

upload-pack.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,21 @@ static void reset_timeout(void)
5858
alarm(timeout);
5959
}
6060

61-
static ssize_t send_client_data(int fd, const char *data, ssize_t sz)
61+
static void send_client_data(int fd, const char *data, ssize_t sz)
6262
{
6363
if (use_sideband) {
6464
send_sideband(1, fd, data, sz, use_sideband);
65-
return sz;
65+
return;
6666
}
6767
if (fd == 3)
6868
/* emergency quit */
6969
fd = 2;
7070
if (fd == 2) {
7171
/* XXX: are we happy to lose stuff here? */
7272
xwrite(fd, data, sz);
73-
return sz;
73+
return;
7474
}
7575
write_or_die(fd, data, sz);
76-
return sz;
7776
}
7877

7978
static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
@@ -231,9 +230,7 @@ static void create_pack_file(void)
231230
}
232231
else
233232
buffered = -1;
234-
sz = send_client_data(1, data, sz);
235-
if (sz < 0)
236-
goto fail;
233+
send_client_data(1, data, sz);
237234
}
238235

239236
/*
@@ -260,9 +257,7 @@ static void create_pack_file(void)
260257
/* flush the data */
261258
if (0 <= buffered) {
262259
data[0] = buffered;
263-
sz = send_client_data(1, data, 1);
264-
if (sz < 0)
265-
goto fail;
260+
send_client_data(1, data, 1);
266261
fprintf(stderr, "flushed.\n");
267262
}
268263
if (use_sideband)

0 commit comments

Comments
 (0)