remove a debugging printf, fix whitespace/indentation, and add a comment re gethostbyname_r buffer size.

This commit is contained in:
Daniel Pouzzner
2022-01-21 13:00:22 -06:00
parent 7a36d57e8f
commit 2955d7339e
4 changed files with 16 additions and 11 deletions

View File

@@ -22,6 +22,7 @@
/*
Example gcc build statement
gcc -lwolfssl -lpthread -o tls_bench tls_bench.c
./tls_bench

View File

@@ -99,7 +99,6 @@ void echoclient_test(void* args)
argv = ((func_args*)args)->argv;
if (argc >= 2) {
fprintf(stderr,"fopen(%s,r)\n",argv[1]);
fin = fopen(argv[1], "r");
inCreated = 1;
}

View File

@@ -918,6 +918,11 @@ int wolfIO_TcpConnect(SOCKET_T* sockfd, const char* ip, word16 port, int to_sec)
}
#else
#if (__GLIBC__ >= 2) && defined(__USE_MISC) && !defined(SINGLE_THREADED)
/* 2048 is a magic number that empirically works. the header and
* documentation provide no guidance on appropriate buffer size other than
* "if buf is too small, the functions will return ERANGE, and the call
* should be retried with a larger buffer."
*/
ghbn_r_buf = (char *)XMALLOC(2048, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (ghbn_r_buf != NULL) {
gethostbyname_r(ip, &entry_buf, ghbn_r_buf, 2048, &entry, &ghbn_r_errno);