aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libtest')
-rw-r--r--tests/libtest/chkdecimalpoint.c2
-rw-r--r--tests/libtest/first.c4
-rw-r--r--tests/libtest/lib1156.c2
-rw-r--r--tests/libtest/lib1502.c4
-rw-r--r--tests/libtest/lib1506.c12
-rw-r--r--tests/libtest/lib1510.c12
-rw-r--r--tests/libtest/lib1512.c12
-rw-r--r--tests/libtest/lib1515.c10
-rw-r--r--tests/libtest/lib1529.c5
-rw-r--r--tests/libtest/lib1560.c4
-rw-r--r--tests/libtest/lib1900.c4
-rw-r--r--tests/libtest/lib518.c64
-rw-r--r--tests/libtest/lib530.c4
-rw-r--r--tests/libtest/lib537.c66
-rw-r--r--tests/libtest/lib540.c4
-rw-r--r--tests/libtest/lib553.c4
-rw-r--r--tests/libtest/libauthretry.c4
-rw-r--r--tests/libtest/libntlmconnect.c4
-rw-r--r--tests/libtest/stub_gssapi.c9
-rw-r--r--tests/libtest/testtrace.c6
20 files changed, 121 insertions, 115 deletions
diff --git a/tests/libtest/chkdecimalpoint.c b/tests/libtest/chkdecimalpoint.c
index b5f5070c0..7bb77150f 100644
--- a/tests/libtest/chkdecimalpoint.c
+++ b/tests/libtest/chkdecimalpoint.c
@@ -33,7 +33,7 @@ int main(void)
int chars;
setlocale(LC_NUMERIC, "");
- chars = snprintf(zero, TOTAL_STR_LEN, "%.1f", 0.0);
+ chars = msnprintf(zero, TOTAL_STR_LEN, "%.1f", 0.0);
if((chars == (TOTAL_STR_LEN - 1)) && (strcmp(zero, "0.0") == 0))
return 0;
else
diff --git a/tests/libtest/first.c b/tests/libtest/first.c
index 86d84cacd..405e6f84a 100644
--- a/tests/libtest/first.c
+++ b/tests/libtest/first.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, 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
@@ -124,7 +124,7 @@ char *hexdump(const unsigned char *buffer, size_t len)
if(len > 200)
return NULL;
for(i = 0; i<len; i++, p += 3)
- snprintf(p, 4, "%02x ", buffer[i]);
+ msnprintf(p, 4, "%02x ", buffer[i]);
return dump;
}
diff --git a/tests/libtest/lib1156.c b/tests/libtest/lib1156.c
index 63348de76..cb8878c21 100644
--- a/tests/libtest/lib1156.c
+++ b/tests/libtest/lib1156.c
@@ -91,7 +91,7 @@ static int onetest(CURL *curl, const char *url, const testparams *p)
replyselector = p->flags & F_CONTENTRANGE? 1: 0;
if(p->flags & F_HTTP416)
replyselector += 2;
- snprintf(urlbuf, sizeof(urlbuf), "%s%04u", url, replyselector);
+ msnprintf(urlbuf, sizeof(urlbuf), "%s%04u", url, replyselector);
test_setopt(curl, CURLOPT_URL, urlbuf);
test_setopt(curl, CURLOPT_RESUME_FROM, (p->flags & F_RESUME)? 3: 0);
test_setopt(curl, CURLOPT_RANGE, !(p->flags & F_RESUME)?
diff --git a/tests/libtest/lib1502.c b/tests/libtest/lib1502.c
index bd7c7c864..6bde00a86 100644
--- a/tests/libtest/lib1502.c
+++ b/tests/libtest/lib1502.c
@@ -50,8 +50,8 @@ int test(char *URL)
/* DNS cache injection */
struct curl_slist *dns_cache_list;
- snprintf(redirect, sizeof(redirect), "google.com:%s:%s", libtest_arg2,
- libtest_arg3);
+ msnprintf(redirect, sizeof(redirect), "google.com:%s:%s", libtest_arg2,
+ libtest_arg3);
start_test_timing();
diff --git a/tests/libtest/lib1506.c b/tests/libtest/lib1506.c
index d456bc95c..1d5e8de4a 100644
--- a/tests/libtest/lib1506.c
+++ b/tests/libtest/lib1506.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013, 2017, Linus Nielsen Feltzing <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -46,8 +46,8 @@ int test(char *URL)
/* Create fake DNS entries for serverX.example.com for all handles */
for(i = 0; i < NUM_HANDLES; i++) {
- snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
- i + 1, port, address);
+ msnprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
+ i + 1, port, address);
printf("%s\n", dnsentry);
slist2 = curl_slist_append(slist, dnsentry);
if(!slist2) {
@@ -70,9 +70,9 @@ int test(char *URL)
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
- snprintf(target_url, sizeof(target_url),
- "http://server%d.example.com:%s/path/1506%04i",
- i + 1, port, i + 1);
+ msnprintf(target_url, sizeof(target_url),
+ "http://server%d.example.com:%s/path/1506%04i",
+ i + 1, port, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go verbose */
diff --git a/tests/libtest/lib1510.c b/tests/libtest/lib1510.c
index d72749b24..4c7b670a0 100644
--- a/tests/libtest/lib1510.c
+++ b/tests/libtest/lib1510.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013, 2017, Linus Nielsen Feltzing <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -44,8 +44,8 @@ int test(char *URL)
/* Create fake DNS entries for serverX.example.com for all handles */
for(i = 0; i < NUM_URLS; i++) {
- snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1,
- port, address);
+ msnprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1,
+ port, address);
printf("%s\n", dnsentry);
slist2 = curl_slist_append(slist, dnsentry);
if(!slist2) {
@@ -74,9 +74,9 @@ int test(char *URL)
/* get NUM_HANDLES easy handles */
for(i = 0; i < NUM_URLS; i++) {
/* specify target */
- snprintf(target_url, sizeof(target_url),
- "http://server%d.example.com:%s/path/1510%04i",
- i + 1, port, i + 1);
+ msnprintf(target_url, sizeof(target_url),
+ "http://server%d.example.com:%s/path/1510%04i",
+ i + 1, port, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl, CURLOPT_URL, target_url);
diff --git a/tests/libtest/lib1512.c b/tests/libtest/lib1512.c
index 1c2578958..0b71ad3f5 100644
--- a/tests/libtest/lib1512.c
+++ b/tests/libtest/lib1512.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013 - 2017, Linus Nielsen Feltzing <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -49,8 +49,8 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
- snprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s",
- port, address);
+ msnprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s",
+ port, address);
printf("%s\n", dnsentry);
slist = curl_slist_append(slist, dnsentry);
@@ -59,9 +59,9 @@ int test(char *URL)
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
- snprintf(target_url, sizeof(target_url),
- "http://server.example.curl:%s/path/1512%04i",
- port, i + 1);
+ msnprintf(target_url, sizeof(target_url),
+ "http://server.example.curl:%s/path/1512%04i",
+ port, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go verbose */
diff --git a/tests/libtest/lib1515.c b/tests/libtest/lib1515.c
index 39bccc59b..c72554a3b 100644
--- a/tests/libtest/lib1515.c
+++ b/tests/libtest/lib1515.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, 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
@@ -123,8 +123,8 @@ int test(char *URL)
int i;
int count = 2;
- snprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s",
- port, address);
+ msnprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s",
+ port, address);
start_test_timing();
@@ -133,8 +133,8 @@ int test(char *URL)
for(i = 1; i <= count; i++) {
char target_url[256];
- snprintf(target_url, sizeof(target_url),
- "http://testserver.example.com:%s/%s%04d", port, path, i);
+ msnprintf(target_url, sizeof(target_url),
+ "http://testserver.example.com:%s/%s%04d", port, path, i);
/* second request must succeed like the first one */
res = do_one_request(multi, target_url, dns_entry);
diff --git a/tests/libtest/lib1529.c b/tests/libtest/lib1529.c
index c63a109b8..8d2210e25 100644
--- a/tests/libtest/lib1529.c
+++ b/tests/libtest/lib1529.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, 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
@@ -29,7 +29,8 @@ int test(char *URL)
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
char bURL[512];
- snprintf(bURL, sizeof(bURL), "%s HTTP/1.1\r\nGET http://1529.com/1529", URL);
+ msnprintf(bURL, sizeof(bURL),
+ "%s HTTP/1.1\r\nGET http://1529.com/1529", URL);
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c
index c95401bcc..7ae1025be 100644
--- a/tests/libtest/lib1560.c
+++ b/tests/libtest/lib1560.c
@@ -67,10 +67,10 @@ static int checkparts(CURLU *u, const char *in, const char *wanted,
size_t n;
rc = curl_url_get(u, parts[i].part, &p, getflags);
if(!rc && p) {
- snprintf(bufp, len, "%s%s", buf[0]?" | ":"", p);
+ msnprintf(bufp, len, "%s%s", buf[0]?" | ":"", p);
}
else
- snprintf(bufp, len, "%s[%d]", buf[0]?" | ":"", (int)rc);
+ msnprintf(bufp, len, "%s[%d]", buf[0]?" | ":"", (int)rc);
n = strlen(bufp);
bufp += n;
diff --git a/tests/libtest/lib1900.c b/tests/libtest/lib1900.c
index cf55fb332..1e10bdf34 100644
--- a/tests/libtest/lib1900.c
+++ b/tests/libtest/lib1900.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013 - 2017, Linus Nielsen Feltzing, <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing, <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -113,7 +113,7 @@ static void setup_handle(char *base_url, CURLM *m, int handlenum)
{
char urlbuf[256];
- snprintf(urlbuf, sizeof(urlbuf), "%s%s", base_url, urlstring[handlenum]);
+ msnprintf(urlbuf, sizeof(urlbuf), "%s%s", base_url, urlstring[handlenum]);
curl_easy_setopt(handles[handlenum], CURLOPT_URL, urlbuf);
curl_easy_setopt(handles[handlenum], CURLOPT_VERBOSE, 1L);
curl_easy_setopt(handles[handlenum], CURLOPT_FAILONERROR, 1L);
diff --git a/tests/libtest/lib518.c b/tests/libtest/lib518.c
index 81c5a5fad..1a3091fcc 100644
--- a/tests/libtest/lib518.c
+++ b/tests/libtest/lib518.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, 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
@@ -55,10 +55,10 @@ static char msgbuff[256];
static void store_errmsg(const char *msg, int err)
{
if(!err)
- snprintf(msgbuff, sizeof(msgbuff), "%s", msg);
+ msnprintf(msgbuff, sizeof(msgbuff), "%s", msg);
else
- snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
- err, strerror(err));
+ msnprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
+ err, strerror(err));
}
static void close_file_descriptors(void)
@@ -132,7 +132,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "initial soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -140,7 +140,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "initial hard limit: %s\n", strbuff);
/* show our constants */
@@ -198,7 +198,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "current soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -206,7 +206,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "current hard limit: %s\n", strbuff);
} /* (rl.rlim_cur != rl.rlim_max) */
@@ -233,10 +233,10 @@ static int rlimit(int keep_open)
(rl.rlim_cur != RLIM_INFINITY) &&
#endif
(rl.rlim_cur <= num_open.rlim_cur)) {
- snprintf(strbuff2, sizeof(strbuff2), fmt, rl.rlim_cur);
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
- strbuff1, strbuff2);
+ msnprintf(strbuff2, sizeof(strbuff2), fmt, rl.rlim_cur);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
+ strbuff1, strbuff2);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
return -4;
@@ -257,7 +257,7 @@ static int rlimit(int keep_open)
nitems = 0x40000;
do {
num_open.rlim_max = sizeof(*memchunk) * (size_t)nitems;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating memchunk %s byte array\n", strbuff);
memchunk = malloc(sizeof(*memchunk) * (size_t)nitems);
if(!memchunk) {
@@ -285,9 +285,9 @@ static int rlimit(int keep_open)
/* verify that we won't overflow size_t in malloc() */
if((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
- "file descriptors, would overflow size_t", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
+ "file descriptors, would overflow size_t", strbuff1);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
free(memchunk);
@@ -296,7 +296,7 @@ static int rlimit(int keep_open)
/* allocate array for file descriptors */
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating array for %s file descriptors\n", strbuff);
fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max));
@@ -316,14 +316,14 @@ static int rlimit(int keep_open)
num_open.rlim_cur++)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "trying to open %s file descriptors\n", strbuff);
/* open a dummy descriptor */
fd[0] = open(DEV_NULL, O_RDONLY);
if(fd[0] < 0) {
- snprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
+ msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
store_errmsg(strbuff, errno);
fprintf(stderr, "%s\n", msgbuff);
free(fd);
@@ -344,20 +344,20 @@ static int rlimit(int keep_open)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
fprintf(stderr, "%s\n", strbuff);
- snprintf(strbuff1, sizeof(strbuff), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
+ msnprintf(strbuff1, sizeof(strbuff), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
strbuff1);
fprintf(stderr, "%s\n", strbuff);
num_open.rlim_max = NUM_NEEDED;
- snprintf(strbuff2, sizeof(strbuff2), fmt, num_open.rlim_max);
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
+ msnprintf(strbuff2, sizeof(strbuff2), fmt, num_open.rlim_max);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
strbuff2, strbuff1);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
@@ -375,7 +375,7 @@ static int rlimit(int keep_open)
}
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "%s file descriptors open\n", strbuff);
#if !defined(HAVE_POLL_FINE) && \
@@ -395,7 +395,7 @@ static int rlimit(int keep_open)
num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
if(num_open.rlim_max > num_open.rlim_cur) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
@@ -410,7 +410,7 @@ static int rlimit(int keep_open)
rl.rlim_cur++) {
if((fd[rl.rlim_cur] > 0) &&
((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
@@ -432,12 +432,12 @@ static int rlimit(int keep_open)
*/
if(!fopen_works()) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff),
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff),
"fopen fails with %s fds open()",
strbuff1);
fprintf(stderr, "%s\n", msgbuff);
- snprintf(strbuff, sizeof(strbuff),
+ msnprintf(strbuff, sizeof(strbuff),
"fopen fails with lots of fds open()");
store_errmsg(strbuff, 0);
close_file_descriptors();
diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c
index 7b71fa5e8..8581303ae 100644
--- a/tests/libtest/lib530.c
+++ b/tests/libtest/lib530.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, 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
@@ -53,7 +53,7 @@ int test(char *URL)
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
- snprintf(target_url, sizeof(target_url), "%s%04i", URL, i + 1);
+ msnprintf(target_url, sizeof(target_url), "%s%04i", URL, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go verbose */
diff --git a/tests/libtest/lib537.c b/tests/libtest/lib537.c
index bdc2e62eb..e8fb16a49 100644
--- a/tests/libtest/lib537.c
+++ b/tests/libtest/lib537.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, 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
@@ -56,10 +56,10 @@ static char msgbuff[256];
static void store_errmsg(const char *msg, int err)
{
if(!err)
- snprintf(msgbuff, sizeof(msgbuff), "%s", msg);
+ msnprintf(msgbuff, sizeof(msgbuff), "%s", msg);
else
- snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg, err,
- strerror(err));
+ msnprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg, err,
+ strerror(err));
}
static void close_file_descriptors(void)
@@ -133,7 +133,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "initial soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -141,7 +141,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "initial hard limit: %s\n", strbuff);
/*
@@ -193,7 +193,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "current soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -201,7 +201,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "current hard limit: %s\n", strbuff);
} /* (rl.rlim_cur != rl.rlim_max) */
@@ -231,7 +231,7 @@ static int rlimit(int keep_open)
nitems = 0x40000;
do {
num_open.rlim_max = sizeof(*memchunk) * nitems;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating memchunk %s byte array\n", strbuff);
memchunk = malloc(sizeof(*memchunk) * (size_t)nitems);
if(!memchunk) {
@@ -274,9 +274,9 @@ static int rlimit(int keep_open)
/* verify that we won't overflow size_t in malloc() */
if((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
- "file descriptors, would overflow size_t", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
+ "file descriptors, would overflow size_t", strbuff1);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
free(memchunk);
@@ -286,7 +286,7 @@ static int rlimit(int keep_open)
/* allocate array for file descriptors */
do {
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating array for %s file descriptors\n", strbuff);
fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max));
if(!fd) {
@@ -310,14 +310,14 @@ static int rlimit(int keep_open)
num_open.rlim_cur++)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "trying to open %s file descriptors\n", strbuff);
/* open a dummy descriptor */
fd[0] = open(DEV_NULL, O_RDONLY);
if(fd[0] < 0) {
- snprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
+ msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
store_errmsg(strbuff, errno);
fprintf(stderr, "%s\n", msgbuff);
free(fd);
@@ -338,21 +338,21 @@ static int rlimit(int keep_open)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
fprintf(stderr, "%s\n", strbuff);
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
- strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
+ strbuff1);
fprintf(stderr, "%s\n", strbuff);
num_open.rlim_max = num_open.rlim_cur - SAFETY_MARGIN;
num_open.rlim_cur -= num_open.rlim_max;
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "closing %s file descriptors",
- strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "closing %s file descriptors",
+ strbuff1);
fprintf(stderr, "%s\n", strbuff);
for(num_open.rlim_cur = num_open.rlim_max;
@@ -362,7 +362,7 @@ static int rlimit(int keep_open)
fd[num_open.rlim_cur] = -1;
}
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "shrinking array for %s file descriptors\n", strbuff);
/* we don't care if we can't shrink it */
@@ -379,7 +379,7 @@ static int rlimit(int keep_open)
}
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "%s file descriptors open\n", strbuff);
#if !defined(HAVE_POLL_FINE) && \
@@ -399,8 +399,8 @@ static int rlimit(int keep_open)
num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
if(num_open.rlim_max > num_open.rlim_cur) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
- FD_SETSIZE);
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
close_file_descriptors();
@@ -414,8 +414,8 @@ static int rlimit(int keep_open)
rl.rlim_cur++) {
if((fd[rl.rlim_cur] > 0) &&
((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
- FD_SETSIZE);
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
close_file_descriptors();
@@ -436,11 +436,11 @@ static int rlimit(int keep_open)
*/
if(!fopen_works()) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
- strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
+ strbuff1);
fprintf(stderr, "%s\n", msgbuff);
- snprintf(strbuff, sizeof(strbuff), "fopen fails with lots of fds open");
+ msnprintf(strbuff, sizeof(strbuff), "fopen fails with lots of fds open");
store_errmsg(strbuff, 0);
close_file_descriptors();
free(memchunk);
diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c
index ff8a9b059..a52d8c501 100644
--- a/tests/libtest/lib540.c
+++ b/tests/libtest/lib540.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, 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
@@ -198,7 +198,7 @@ int test(char *URL)
if(test_argc < 4)
return 99;
- snprintf(buffer, sizeof(buffer), "Host: %s", HOST);
+ msnprintf(buffer, sizeof(buffer), "Host: %s", HOST);
/* now add a custom Host: header */
headers = curl_slist_append(headers, buffer);
diff --git a/tests/libtest/lib553.c b/tests/libtest/lib553.c
index c06561e1d..95b5ac393 100644
--- a/tests/libtest/lib553.c
+++ b/tests/libtest/lib553.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, 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
@@ -75,7 +75,7 @@ int test(char *URL)
}
for(i = 0; i < NUM_HEADERS; i++) {
- int len = snprintf(buf, sizeof(buf), "Header%d: ", i);
+ int len = msnprintf(buf, sizeof(buf), "Header%d: ", i);
memset(&buf[len], 'A', SIZE_HEADERS);
buf[len + SIZE_HEADERS] = 0; /* zero terminate */
hl = curl_slist_append(headerlist, buf);
diff --git a/tests/libtest/libauthretry.c b/tests/libtest/libauthretry.c
index 8e348ad19..cfad6f3e9 100644
--- a/tests/libtest/libauthretry.c
+++ b/tests/libtest/libauthretry.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, 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
@@ -38,7 +38,7 @@ static CURLcode send_request(CURL *curl, const char *url, int seq,
return CURLE_OUT_OF_MEMORY;
}
- snprintf(full_url, len, "%s%04d", url, seq);
+ msnprintf(full_url, len, "%s%04d", url, seq);
fprintf(stderr, "Sending new request %d to %s with credential %s "
"(auth %ld)\n", seq, full_url, userpwd, auth_scheme);
test_setopt(curl, CURLOPT_URL, full_url);
diff --git a/tests/libtest/libntlmconnect.c b/tests/libtest/libntlmconnect.c
index e17b991a4..426f6f245 100644
--- a/tests/libtest/libntlmconnect.c
+++ b/tests/libtest/libntlmconnect.c
@@ -135,11 +135,11 @@ int test(char *url)
easy_init(easy[num_handles]);
if(num_handles % 3 == 2) {
- snprintf(full_url, urllen, "%s0200", url);
+ msnprintf(full_url, urllen, "%s0200", url);
easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
}
else {
- snprintf(full_url, urllen, "%s0100", url);
+ msnprintf(full_url, urllen, "%s0100", url);
easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
}
easy_setopt(easy[num_handles], CURLOPT_FRESH_CONNECT, 1L);
diff --git a/tests/libtest/stub_gssapi.c b/tests/libtest/stub_gssapi.c
index aaa7796b3..254a01b31 100644
--- a/tests/libtest/stub_gssapi.c
+++ b/tests/libtest/stub_gssapi.c
@@ -28,6 +28,11 @@
#include "stub_gssapi.h"
+#define ENABLE_CURLX_PRINTF
+/* make the curlx header define all printf() functions to use the curlx_*
+ versions instead */
+#include "curlx.h" /* from the private lib dir */
+
#define MAX_CREDS_LENGTH 250
#define APPROX_TOKEN_LEN 250
@@ -202,8 +207,8 @@ OM_uint32 gss_init_sec_context(OM_uint32 *min,
}
/* Token format: creds:target:type:padding */
- used = snprintf(token, length, "%s:%s:%d:", creds,
- (char *) target_name, ctx->sent);
+ used = msnprintf(token, length, "%s:%s:%d:", creds,
+ (char *) target_name, ctx->sent);
if(used >= length) {
free(token);
diff --git a/tests/libtest/testtrace.c b/tests/libtest/testtrace.c
index 0a98d006f..2718ef939 100644
--- a/tests/libtest/testtrace.c
+++ b/tests/libtest/testtrace.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, 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
@@ -108,8 +108,8 @@ int libtest_debug_cb(CURL *handle, curl_infotype type,
}
secs = epoch_offset + tv.tv_sec;
now = localtime(&secs); /* not thread safe but we don't care */
- snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ",
- now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
+ msnprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ",
+ now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
}
switch(type) {