[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10845: Apply patch from tup: remove extra space at the end of some (in tor/trunk: . src/or)



Author: nickm
Date: 2007-07-16 13:27:35 -0400 (Mon, 16 Jul 2007)
New Revision: 10845

Modified:
   tor/trunk/
   tor/trunk/src/or/control.c
Log:
 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.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r13784] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2007-07-16 16:58:11 UTC (rev 10844)
+++ tor/trunk/src/or/control.c	2007-07-16 17:27:35 UTC (rev 10845)
@@ -284,7 +284,7 @@
 {
   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 @@
   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 @@
 
       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);
     }