summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 0eb3cf0..4208743 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -54,7 +54,7 @@ static int recvline_fh(FILE *helper, struct strbuf *buffer, const char *name)
strbuf_reset(buffer);
if (debug)
fprintf(stderr, "Debug: Remote helper: Waiting...\n");
- if (strbuf_getline(buffer, helper, '\n') == EOF) {
+ if (strbuf_getline(buffer, helper) == EOF) {
if (debug)
fprintf(stderr, "Debug: Remote helper quit.\n");
return 1;
@@ -137,7 +137,8 @@ static struct child_process *get_helper(struct transport *transport)
data->no_disconnect_req = 0;
/*
- * Open the output as FILE* so strbuf_getline() can be used.
+ * Open the output as FILE* so strbuf_getline_*() family of
+ * functions can be used.
* Do this with duped fd because fclose() will close the fd,
* and stuff like taking over will require the fd to remain.
*/
@@ -320,6 +321,21 @@ static void standard_options(struct transport *t)
if (n >= sizeof(buf))
die("impossibly large verbosity value");
set_helper_option(t, "verbosity", buf);
+
+ switch (t->family) {
+ case TRANSPORT_FAMILY_ALL:
+ /*
+ * this is already the default,
+ * do not break old remote helpers by setting "all" here
+ */
+ break;
+ case TRANSPORT_FAMILY_IPV4:
+ set_helper_option(t, "family", "ipv4");
+ break;
+ case TRANSPORT_FAMILY_IPV6:
+ set_helper_option(t, "family", "ipv6");
+ break;
+ }
}
static int release_helper(struct transport *transport)
@@ -1022,7 +1038,7 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
(*tail)->status |= REF_STATUS_UPTODATE;
if (read_ref((*tail)->name,
(*tail)->old_oid.hash) < 0)
- die(N_("Could not read ref %s"),
+ die(_("Could not read ref %s"),
(*tail)->name);
}
}
@@ -1136,7 +1152,7 @@ static void udt_close_if_finished(struct unidirectional_transfer *t)
}
/*
- * Tries to read read data from source into buffer. If buffer is full,
+ * Tries to read data from source into buffer. If buffer is full,
* no data is read. Returns 0 on success, -1 on error.
*/
static int udt_do_read(struct unidirectional_transfer *t)
@@ -1150,7 +1166,7 @@ static int udt_do_read(struct unidirectional_transfer *t)
bytes = read(t->src, t->buf + t->bufuse, BUFFERSIZE - t->bufuse);
if (bytes < 0 && errno != EWOULDBLOCK && errno != EAGAIN &&
errno != EINTR) {
- error("read(%s) failed: %s", t->src_name, strerror(errno));
+ error_errno("read(%s) failed", t->src_name);
return -1;
} else if (bytes == 0) {
transfer_debug("%s EOF (with %i bytes in buffer)",
@@ -1177,7 +1193,7 @@ static int udt_do_write(struct unidirectional_transfer *t)
transfer_debug("%s is writable", t->dest_name);
bytes = xwrite(t->dest, t->buf, t->bufuse);
if (bytes < 0 && errno != EWOULDBLOCK) {
- error("write(%s) failed: %s", t->dest_name, strerror(errno));
+ error_errno("write(%s) failed", t->dest_name);
return -1;
} else if (bytes > 0) {
t->bufuse -= bytes;
@@ -1290,7 +1306,7 @@ static int tloop_join(pid_t pid, const char *name)
{
int tret;
if (waitpid(pid, &tret, 0) < 0) {
- error("%s process failed to wait: %s", name, strerror(errno));
+ error_errno("%s process failed to wait", name);
return 1;
}
if (!WIFEXITED(tret) || WEXITSTATUS(tret)) {