X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=transport-helper.c;h=f6b3b1fb79468ef85eb9581c7d44ff04c1bb61bc;hb=b1d645b58ac6c96ffdc8d9a01f0b44a10deb43f9;hp=07131261fefeab2066636a7f83bce05796329a54;hpb=901c907d83f523a5df0b10c0aafb19c512836624;p=git.git diff --git a/transport-helper.c b/transport-helper.c index 07131261f..f6b3b1fb7 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -9,6 +9,7 @@ #include "remote.h" #include "string-list.h" #include "thread-utils.h" +#include "sigchain.h" static int debug; @@ -220,15 +221,21 @@ static struct child_process *get_helper(struct transport *transport) static int disconnect_helper(struct transport *transport) { struct helper_data *data = transport->data; - struct strbuf buf = STRBUF_INIT; int res = 0; if (data->helper) { if (debug) fprintf(stderr, "Debug: Disconnecting.\n"); if (!data->no_disconnect_req) { - strbuf_addf(&buf, "\n"); - sendline(data, &buf); + /* + * Ignore write errors; there's nothing we can do, + * since we're about to close the pipe anyway. And the + * most likely error is EPIPE due to the helper dying + * to report an error itself. + */ + sigchain_push(SIGPIPE, SIG_IGN); + xwrite(data->helper->in, "\n", 1); + sigchain_pop(SIGPIPE); } close(data->helper->in); close(data->helper->out); @@ -446,8 +453,10 @@ static int fetch_with_import(struct transport *transport, private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name); else private = xstrdup(posn->name); - read_ref(private, posn->old_sha1); - free(private); + if (private) { + read_ref(private, posn->old_sha1); + free(private); + } } strbuf_release(&buf); return 0;