summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-07-16 17:27:35 +0000
committerNick Mathewson <nickm@torproject.org>2007-07-16 17:27:35 +0000
commit6e9f1f76f21306d8c4d66af990f11e78f6dc234d (patch)
tree48d911515bea151737cc44ef5446e04994ae0640 /src
parent26a25edaec6a71173e866d4632ace6af22de892f (diff)
downloadtor-6e9f1f76f21306d8c4d66af990f11e78f6dc234d.tar.gz
tor-6e9f1f76f21306d8c4d66af990f11e78f6dc234d.zip
r13784@catbus: nickm | 2007-07-16 13:27:32 -0400
Apply patch from tup: remove extra space at the end of some circuit-status events, and stop translating CRLF to CRCRLF in control replies. svn:r10845
Diffstat (limited to 'src')
-rw-r--r--src/or/control.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 775dda3c35..fc4c002d05 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -284,7 +284,7 @@ write_escaped_data(const char *data, size_t len, int translate_newlines,
{
size_t sz_out = len+8;
char *outp;
- const char *end;
+ const char *start = data, *end;
int i;
int start_of_line;
for (i=0; i<(int)len; ++i) {
@@ -296,7 +296,7 @@ write_escaped_data(const char *data, size_t len, int translate_newlines,
start_of_line = 1;
while (data < end) {
if (*data == '\n') {
- if (translate_newlines)
+ if (translate_newlines && data > start && data[-1] != '\r')
*outp++ = '\r';
start_of_line = 1;
} else if (*data == '.') {
@@ -1363,9 +1363,9 @@ getinfo_helper_events(control_connection_t *control_conn,
slen = strlen(path)+strlen(state)+20;
s = tor_malloc(slen+1);
- tor_snprintf(s, slen, "%lu %s %s",
+ tor_snprintf(s, slen, "%lu %s%s%s",
(unsigned long)TO_ORIGIN_CIRCUIT(circ)->global_identifier,
- state, path);
+ state, *path ? " " : "", path);
smartlist_add(status, s);
tor_free(path);
}