Commit 27cdbdd1 authored by Junio C Hamano's avatar Junio C Hamano

Merge branch 'jk/no-sigpipe-during-network-transport'

On platforms where "git fetch" is killed with SIGPIPE (e.g. OSX),
the upload-pack that runs on the other end that hangs up after
detecting an error could cause "git fetch" to die with a signal,
which led to a flakey test.  "git fetch" now ignores SIGPIPE during
the network portion of its operation (this is not a problem as we
check the return status from our write(2)s).

* jk/no-sigpipe-during-network-transport:
  fetch: ignore SIGPIPE during network operation
  fetch: avoid calling write_or_die()
parents ea327760 14358894
......@@ -1556,7 +1556,9 @@ static int fetch_one(struct remote *remote, int argc, const char **argv, int pru
sigchain_push(SIGPIPE, SIG_IGN);
exit_code = do_fetch(gtransport, &rs);
gtransport = NULL;
......@@ -191,8 +191,10 @@ static void send_request(struct fetch_pack_args *args,
if (args->stateless_rpc) {
send_sideband(fd, -1, buf->buf, buf->len, LARGE_PACKET_MAX);
} else
write_or_die(fd, buf->buf, buf->len);
} else {
if (write_in_full(fd, buf->buf, buf->len) < 0)
die_errno(_("unable to write to remote"));
static void insert_one_alternate_object(struct fetch_negotiator *negotiator,
......@@ -1163,7 +1165,8 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
/* Send request */
write_or_die(fd_out, req_buf.buf, req_buf.len);
if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
die_errno(_("unable to write request to remote"));
return ret;
......@@ -88,13 +88,15 @@ static void packet_trace(const char *buf, unsigned int len, int write)
void packet_flush(int fd)
packet_trace("0000", 4, 1);
write_or_die(fd, "0000", 4);
if (write_in_full(fd, "0000", 4) < 0)
die_errno(_("unable to write flush packet"));
void packet_delim(int fd)
packet_trace("0001", 4, 1);
write_or_die(fd, "0001", 4);
if (write_in_full(fd, "0001", 4) < 0)
die_errno(_("unable to write delim packet"));
int packet_flush_gently(int fd)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment