]> granicus.if.org Git - curl/commitdiff
when sending an error message to the debugfunction, we append a newline so
authorDaniel Stenberg <daniel@haxx.se>
Tue, 7 Jan 2003 11:23:52 +0000 (11:23 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 7 Jan 2003 11:23:52 +0000 (11:23 +0000)
that the output looks better

lib/sendf.c

index add8af9ef8f38a90b964b4929593231eefc6474b..28297f4d87970a58e1595b8ef65f25966a5909eb 100644 (file)
@@ -154,9 +154,19 @@ void Curl_failf(struct SessionHandle *data, const char *fmt, ...)
     vsnprintf(data->set.errorbuffer, CURL_ERROR_SIZE, fmt, ap);
     data->state.errorbuf = TRUE; /* wrote error string */
 
-    if(data->set.verbose)
-      Curl_debug(data, CURLINFO_TEXT, data->set.errorbuffer,
-                 strlen(data->set.errorbuffer));
+    if(data->set.verbose) {
+      int len = strlen(data->set.errorbuffer);
+      bool doneit=FALSE;
+      if(len < CURL_ERROR_SIZE) {
+        doneit = TRUE;
+        data->set.errorbuffer[len] = '\n';
+        data->set.errorbuffer[++len] = '\0';
+      }
+      Curl_debug(data, CURLINFO_TEXT, data->set.errorbuffer, len);
+      if(doneit)
+        /* cut off the newline again */
+        data->set.errorbuffer[--len]=0;
+    }
   }
   va_end(ap);
 }