Просмотр исходного кода

- fixed bug in print_routeset (reported by Alexander Mayrhofer)

Jan Janak 22 лет назад
Родитель
Сommit
6a512d257a
1 измененных файлов с 8 добавлено и 4 удалено
  1. 8 4
      modules/tm/dlg.c

+ 8 - 4
modules/tm/dlg.c

@@ -862,7 +862,7 @@ char* print_routeset(char* buf, dlg_t* _d)
 
 	ptr = _d->hooks.first_route;
 
-	if (ptr) {
+	if (ptr || _d->hooks.last_route) {
 		memcpy(buf, ROUTE_PREFIX, ROUTE_PREFIX_LEN);
 		buf += ROUTE_PREFIX_LEN;
 	}
@@ -879,15 +879,19 @@ char* print_routeset(char* buf, dlg_t* _d)
 	} 
 
 	if (_d->hooks.last_route) {
-		memcpy(buf, ROUTE_SEPARATOR "<", ROUTE_SEPARATOR_LEN + 1);
-		buf += ROUTE_SEPARATOR_LEN + 1;
+		if (_d->hooks.first_route) {
+			memcpy(buf, ROUTE_SEPARATOR, ROUTE_SEPARATOR_LEN);
+			buf += ROUTE_SEPARATOR_LEN;
+		}
+		memcpy(buf, "<", 1);
+		buf++;
 		memcpy(buf, _d->hooks.last_route->s, _d->hooks.last_route->len);
 		buf += _d->hooks.last_route->len;
 		*buf = '>';
 		buf++;
 	}
 
-	if (_d->hooks.first_route) {
+	if (_d->hooks.first_route || _d->hooks.last_route) {
 		memcpy(buf, CRLF, CRLF_LEN);
 		buf += CRLF_LEN;
 	}