Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infof: remove newline from format strings, always append it #7357

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/altsvc.c
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2019 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -460,7 +460,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
(void)data;
#endif
if(result) {
infof(data, "Excessive alt-svc header, ignoring...\n");
infof(data, "Excessive alt-svc header, ignoring.");
return CURLE_OK;
}

Expand Down Expand Up @@ -496,7 +496,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
p++;
len = p - hostp;
if(!len || (len >= MAX_ALTSVC_HOSTLEN)) {
infof(data, "Excessive alt-svc host name, ignoring...\n");
infof(data, "Excessive alt-svc host name, ignoring.");
dstalpnid = ALPN_none;
}
else {
Expand All @@ -513,7 +513,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
/* a port number */
unsigned long port = strtoul(++p, &end_ptr, 10);
if(port > USHRT_MAX || end_ptr == p || *end_ptr != '\"') {
infof(data, "Unknown alt-svc port number, ignoring...\n");
infof(data, "Unknown alt-svc port number, ignoring.");
dstalpnid = ALPN_none;
}
p = end_ptr;
Expand Down Expand Up @@ -579,12 +579,12 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
as->expires = maxage + time(NULL);
as->persist = persist;
Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);
infof(data, "Added alt-svc: %s:%d over %s\n", dsthost, dstport,
infof(data, "Added alt-svc: %s:%d over %s", dsthost, dstport,
Curl_alpnid2str(dstalpnid));
}
}
else {
infof(data, "Unknown alt-svc protocol \"%s\", skipping...\n",
infof(data, "Unknown alt-svc protocol \"%s\", skipping.",
alpnbuf);
}
}
Expand Down
10 changes: 5 additions & 5 deletions lib/c-hyper.c
Expand Up @@ -187,7 +187,7 @@ static int hyper_body_chunk(void *userdata, const hyper_buf *chunk)
(conn->http_ntlm_state == NTLMSTATE_TYPE2)) ||
((data->req.httpcode == 407) &&
(conn->proxy_ntlm_state == NTLMSTATE_TYPE2)))) {
infof(data, "Connection closed while negotiating NTLM\n");
infof(data, "Connection closed while negotiating NTLM");
data->state.authproblem = TRUE;
Curl_safefree(data->req.newurl);
}
Expand All @@ -200,7 +200,7 @@ static int hyper_body_chunk(void *userdata, const hyper_buf *chunk)
else
result = Curl_http_firstwrite(data, data->conn, &done);
if(result || done) {
infof(data, "Return early from hyper_body_chunk\n");
infof(data, "Return early from hyper_body_chunk");
data->state.hresult = result;
return HYPER_ITER_BREAK;
}
Expand Down Expand Up @@ -345,7 +345,7 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
if(errnum == HYPERE_ABORTED_BY_CALLBACK) {
/* override Hyper's view, might not even be an error */
result = data->state.hresult;
infof(data, "hyperstream is done (by early callback)\n");
infof(data, "hyperstream is done (by early callback)");
}
else {
uint8_t errbuf[256];
Expand All @@ -366,7 +366,7 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
else if(h->endtask == task) {
/* end of transfer */
*done = TRUE;
infof(data, "hyperstream is done!\n");
infof(data, "hyperstream is done!");
break;
}
else if(t != HYPER_TASK_RESPONSE) {
Expand Down Expand Up @@ -707,7 +707,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
the rest of the request in the PERFORM phase. */
*done = TRUE;

infof(data, "Time for the Hyper dance\n");
infof(data, "Time for the Hyper dance");
memset(h, 0, sizeof(struct hyptransfer));

result = Curl_http_host(data, conn);
Expand Down
10 changes: 5 additions & 5 deletions lib/conncache.c
Expand Up @@ -266,7 +266,7 @@ CURLcode Curl_conncache_add_conn(struct Curl_easy *data)
connc->num_conn++;

DEBUGF(infof(data, "Added connection %ld. "
"The cache now contains %zu members\n",
"The cache now contains %zu members",
conn->connection_id, connc->num_conn));

unlock:
Expand Down Expand Up @@ -300,7 +300,7 @@ void Curl_conncache_remove_conn(struct Curl_easy *data,
conn->bundle = NULL; /* removed from it */
if(connc) {
connc->num_conn--;
DEBUGF(infof(data, "The cache now contains %zu members\n",
DEBUGF(infof(data, "The cache now contains %zu members",
connc->num_conn));
}
if(lock) {
Expand Down Expand Up @@ -410,7 +410,7 @@ bool Curl_conncache_return_conn(struct Curl_easy *data,
conn->lastused = Curl_now(); /* it was used up until now */
if(maxconnects > 0 &&
Curl_conncache_size(data) > maxconnects) {
infof(data, "Connection cache is full, closing the oldest one.\n");
infof(data, "Connection cache is full, closing the oldest one");

conn_candidate = Curl_conncache_extract_oldest(data);
if(conn_candidate) {
Expand Down Expand Up @@ -466,7 +466,7 @@ Curl_conncache_extract_bundle(struct Curl_easy *data,
/* remove it to prevent another thread from nicking it */
bundle_remove_conn(bundle, conn_candidate);
data->state.conn_cache->num_conn--;
DEBUGF(infof(data, "The cache now contains %zu members\n",
DEBUGF(infof(data, "The cache now contains %zu members",
data->state.conn_cache->num_conn));
}

Expand Down Expand Up @@ -528,7 +528,7 @@ Curl_conncache_extract_oldest(struct Curl_easy *data)
/* remove it to prevent another thread from nicking it */
bundle_remove_conn(bundle_candidate, conn_candidate);
connc->num_conn--;
DEBUGF(infof(data, "The cache now contains %zu members\n",
DEBUGF(infof(data, "The cache now contains %zu members",
connc->num_conn));
}
CONNCACHE_UNLOCK(data);
Expand Down
34 changes: 17 additions & 17 deletions lib/connect.c
Expand Up @@ -111,7 +111,7 @@ tcpkeepalive(struct Curl_easy *data,
/* only set IDLE and INTVL if setting KEEPALIVE is successful */
if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE,
(void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set SO_KEEPALIVE on fd %d\n", sockfd);
infof(data, "Failed to set SO_KEEPALIVE on fd %d", sockfd);
}
else {
#if defined(SIO_KEEPALIVE_VALS)
Expand All @@ -126,7 +126,7 @@ tcpkeepalive(struct Curl_easy *data,
vals.keepaliveinterval = optval;
if(WSAIoctl(sockfd, SIO_KEEPALIVE_VALS, (LPVOID) &vals, sizeof(vals),
NULL, 0, &dummy, NULL, NULL) != 0) {
infof(data, "Failed to set SIO_KEEPALIVE_VALS on fd %d: %d\n",
infof(data, "Failed to set SIO_KEEPALIVE_VALS on fd %d: %d",
(int)sockfd, WSAGetLastError());
}
#else
Expand All @@ -135,15 +135,15 @@ tcpkeepalive(struct Curl_easy *data,
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE,
(void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set TCP_KEEPIDLE on fd %d\n", sockfd);
infof(data, "Failed to set TCP_KEEPIDLE on fd %d", sockfd);
}
#endif
#ifdef TCP_KEEPINTVL
optval = curlx_sltosi(data->set.tcp_keepintvl);
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL,
(void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set TCP_KEEPINTVL on fd %d\n", sockfd);
infof(data, "Failed to set TCP_KEEPINTVL on fd %d", sockfd);
}
#endif
#ifdef TCP_KEEPALIVE
Expand All @@ -152,7 +152,7 @@ tcpkeepalive(struct Curl_easy *data,
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE,
(void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set TCP_KEEPALIVE on fd %d\n", sockfd);
infof(data, "Failed to set TCP_KEEPALIVE on fd %d", sockfd);
}
#endif
#endif
Expand Down Expand Up @@ -331,7 +331,7 @@ static CURLcode bindlocal(struct Curl_easy *data,
/*
* We now have the numerical IP address in the 'myhost' buffer
*/
infof(data, "Local Interface %s is ip %s using address family %i\n",
infof(data, "Local Interface %s is ip %s using address family %i",
dev, myhost, af);
done = 1;
break;
Expand Down Expand Up @@ -364,7 +364,7 @@ static CURLcode bindlocal(struct Curl_easy *data,
if(h) {
/* convert the resolved address, sizeof myhost >= INET_ADDRSTRLEN */
Curl_printable_address(h->addr, myhost, sizeof(myhost));
infof(data, "Name '%s' family %i resolved to '%s' family %i\n",
infof(data, "Name '%s' family %i resolved to '%s' family %i",
dev, af, myhost, h->addr->ai_family);
Curl_resolv_unlock(data, h);
if(af != h->addr->ai_family) {
Expand Down Expand Up @@ -458,13 +458,13 @@ static CURLcode bindlocal(struct Curl_easy *data,
error, Curl_strerror(error, buffer, sizeof(buffer)));
return CURLE_INTERFACE_FAILED;
}
infof(data, "Local port: %hu\n", port);
infof(data, "Local port: %hu", port);
conn->bits.bound = TRUE;
return CURLE_OK;
}

if(--portnum > 0) {
infof(data, "Bind to local port %hu failed, trying next\n", port);
infof(data, "Bind to local port %hu failed, trying next", port);
port++; /* try next port */
/* We re-use/clobber the port variable here below */
if(sock->sa_family == AF_INET)
Expand Down Expand Up @@ -921,7 +921,7 @@ CURLcode Curl_is_connected(struct Curl_easy *data,
if(Curl_timediff(now, conn->connecttime) >=
conn->timeoutms_per_addr[i]) {
infof(data, "After %" CURL_FORMAT_TIMEDIFF_T
"ms connect time, move on!\n", conn->timeoutms_per_addr[i]);
"ms connect time, move on!", conn->timeoutms_per_addr[i]);
error = ETIMEDOUT;
}

Expand Down Expand Up @@ -980,7 +980,7 @@ CURLcode Curl_is_connected(struct Curl_easy *data,
char buffer[STRERROR_LEN];
Curl_printable_address(conn->tempaddr[i], ipaddress,
sizeof(ipaddress));
infof(data, "connect to %s port %u failed: %s\n",
infof(data, "connect to %s port %u failed: %s",
ipaddress, conn->port,
Curl_strerror(error, buffer, sizeof(buffer)));
#endif
Expand Down Expand Up @@ -1073,7 +1073,7 @@ static void tcpnodelay(struct Curl_easy *data, curl_socket_t sockfd)

if(setsockopt(sockfd, level, TCP_NODELAY, (void *)&onoff,
sizeof(onoff)) < 0)
infof(data, "Could not set TCP_NODELAY: %s\n",
infof(data, "Could not set TCP_NODELAY: %s",
Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
#else
(void)data;
Expand All @@ -1093,7 +1093,7 @@ static void nosigpipe(struct Curl_easy *data,
if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&onoff,
sizeof(onoff)) < 0) {
char buffer[STRERROR_LEN];
infof(data, "Could not set SO_NOSIGPIPE: %s\n",
infof(data, "Could not set SO_NOSIGPIPE: %s",
Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
}
}
Expand Down Expand Up @@ -1188,7 +1188,7 @@ static CURLcode singleipconnect(struct Curl_easy *data,
Curl_closesocket(data, conn, sockfd);
return CURLE_OK;
}
infof(data, " Trying %s:%d...\n", ipaddress, port);
infof(data, " Trying %s:%d...", ipaddress, port);

#ifdef ENABLE_IPV6
is_tcp = (addr.family == AF_INET || addr.family == AF_INET6) &&
Expand Down Expand Up @@ -1279,7 +1279,7 @@ static CURLcode singleipconnect(struct Curl_easy *data,
#elif defined(TCP_FASTOPEN_CONNECT) /* Linux >= 4.11 */
if(setsockopt(sockfd, IPPROTO_TCP, TCP_FASTOPEN_CONNECT,
(void *)&optval, sizeof(optval)) < 0)
infof(data, "Failed to enable TCP Fast Open on fd %d\n", sockfd);
infof(data, "Failed to enable TCP Fast Open on fd %d", sockfd);

rc = connect(sockfd, &addr.sa_addr, addr.addrlen);
#elif defined(MSG_FASTOPEN) /* old Linux */
Expand Down Expand Up @@ -1329,7 +1329,7 @@ static CURLcode singleipconnect(struct Curl_easy *data,

default:
/* unknown error, fallthrough and try another address! */
infof(data, "Immediate connect fail for %s: %s\n",
infof(data, "Immediate connect fail for %s: %s",
ipaddress, Curl_strerror(error, buffer, sizeof(buffer)));
data->state.os_errno = error;

Expand Down Expand Up @@ -1402,7 +1402,7 @@ CURLcode Curl_connecthost(struct Curl_easy *data,

ainext(conn, 1, FALSE); /* assigns conn->tempaddr[1] accordingly */

DEBUGF(infof(data, "family0 == %s, family1 == %s\n",
DEBUGF(infof(data, "family0 == %s, family1 == %s",
conn->tempfamily[0] == AF_INET ? "v4" : "v6",
conn->tempfamily[1] == AF_INET ? "v4" : "v6"));

Expand Down
12 changes: 6 additions & 6 deletions lib/cookie.c
Expand Up @@ -340,7 +340,7 @@ void Curl_cookie_loadfiles(struct Curl_easy *data)
* Failure may be due to OOM or a bad cookie; both are ignored
* but only the first should be
*/
infof(data, "ignoring failed cookie_init for %s\n", list->data);
infof(data, "ignoring failed cookie_init for %s", list->data);
else
data->cookies = newcookies;
list = list->next;
Expand Down Expand Up @@ -520,7 +520,7 @@ Curl_cookie_add(struct Curl_easy *data,
if(nlen >= (MAX_NAME-1) || len >= (MAX_NAME-1) ||
((nlen + len) > MAX_NAME)) {
freecookie(co);
infof(data, "oversized cookie dropped, name/val %zu + %zu bytes\n",
infof(data, "oversized cookie dropped, name/val %zu + %zu bytes",
nlen, len);
return NULL;
}
Expand Down Expand Up @@ -661,7 +661,7 @@ Curl_cookie_add(struct Curl_easy *data,
* not a domain to which the current host belongs. Mark as bad.
*/
badcookie = TRUE;
infof(data, "skipped cookie with bad tailmatch domain: %s\n",
infof(data, "skipped cookie with bad tailmatch domain: %s",
whatptr);
}
}
Expand Down Expand Up @@ -1005,7 +1005,7 @@ Curl_cookie_add(struct Curl_easy *data,

if(!acceptable) {
infof(data, "cookie '%s' dropped, domain '%s' must not "
"set cookies for '%s'\n", co->name, domain, co->domain);
"set cookies for '%s'", co->name, domain, co->domain);
freecookie(co);
return NULL;
}
Expand Down Expand Up @@ -1117,7 +1117,7 @@ Curl_cookie_add(struct Curl_easy *data,
if(c->running)
/* Only show this when NOT reading the cookies from a file */
infof(data, "%s cookie %s=\"%s\" for domain %s, path %s, "
"expire %" CURL_FORMAT_CURL_OFF_T "\n",
"expire %" CURL_FORMAT_CURL_OFF_T,
replace_old?"Replaced":"Added", co->name, co->value,
co->domain, co->path, co->expires);

Expand Down Expand Up @@ -1743,7 +1743,7 @@ void Curl_flush_cookies(struct Curl_easy *data, bool cleanup)
/* if we have a destination file for all the cookies to get dumped to */
res = cookie_output(data, data->cookies, data->set.str[STRING_COOKIEJAR]);
if(res)
infof(data, "WARNING: failed to save cookies in %s: %s\n",
infof(data, "WARNING: failed to save cookies in %s: %s",
data->set.str[STRING_COOKIEJAR], curl_easy_strerror(res));
}
else {
Expand Down
4 changes: 2 additions & 2 deletions lib/curl_gssapi.c
Expand Up @@ -59,7 +59,7 @@ OM_uint32 Curl_gss_init_sec_context(
req_flags |= GSS_C_DELEG_POLICY_FLAG;
#else
infof(data, "warning: support for CURLGSSAPI_DELEGATION_POLICY_FLAG not "
"compiled in\n");
"compiled in");
#endif
}

Expand Down Expand Up @@ -130,7 +130,7 @@ void Curl_gss_log_error(struct Curl_easy *data, const char *prefix,

display_gss_error(minor, GSS_C_MECH_CODE, buf, len);

infof(data, "%s%s\n", prefix, buf);
infof(data, "%s%s", prefix, buf);
#ifdef CURL_DISABLE_VERBOSE_STRINGS
(void)data;
(void)prefix;
Expand Down
6 changes: 3 additions & 3 deletions lib/curl_ntlm_wb.c
Expand Up @@ -355,17 +355,17 @@ CURLcode Curl_input_ntlm_wb(struct Curl_easy *data,
}
else {
if(*state == NTLMSTATE_LAST) {
infof(data, "NTLM auth restarted\n");
infof(data, "NTLM auth restarted");
Curl_http_auth_cleanup_ntlm_wb(conn);
}
else if(*state == NTLMSTATE_TYPE3) {
infof(data, "NTLM handshake rejected\n");
infof(data, "NTLM handshake rejected");
Curl_http_auth_cleanup_ntlm_wb(conn);
*state = NTLMSTATE_NONE;
return CURLE_REMOTE_ACCESS_DENIED;
}
else if(*state >= NTLMSTATE_TYPE1) {
infof(data, "NTLM handshake failure (internal error)\n");
infof(data, "NTLM handshake failure (internal error)");
return CURLE_REMOTE_ACCESS_DENIED;
}

Expand Down