libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 91548850d961783a8f5b288c69ce83ecb89d3ddc
parent 2123decd504e9fe024db7efba6d199b3457c7ad9
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 10 Mar 2017 16:40:27 +0100

check system call return values in tests

Diffstat:
Msrc/examples/fileserver_example.c | 8+++++---
Msrc/testcurl/https/test_empty_response.c | 8++++++--
Msrc/testcurl/https/test_https_get_select.c | 10+++++++---
3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/examples/fileserver_example.c b/src/examples/fileserver_example.c @@ -79,7 +79,8 @@ ahc_echo (void *cls, (! S_ISREG (buf.st_mode)) ) { /* not a regular file, refuse to serve */ - close (fd); + if (0 != close (fd)) + abort (); fd = -1; } } @@ -93,10 +94,11 @@ ahc_echo (void *cls, } else { - response = MHD_create_response_from_fd64(buf.st_size, fd); + response = MHD_create_response_from_fd64 (buf.st_size, fd); if (NULL == response) { - close (fd); + if (0 != close (fd)) + abort (); return MHD_NO; } ret = MHD_queue_response (connection, MHD_HTTP_OK, response); diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c @@ -81,7 +81,7 @@ testInternalSelectGet () cbc.size = 2048; cbc.pos = 0; d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_TLS | MHD_USE_INTERNAL_POLLING_THREAD, - 1082, NULL, NULL, &ahc_echo, "GET", + 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); @@ -149,7 +149,11 @@ testInternalSelectGet () } tv.tv_sec = 0; tv.tv_usec = 1000; - select (maxposixs + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c @@ -101,7 +101,7 @@ testExternalGet (int flags) cbc.size = 2048; cbc.pos = 0; d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_TLS | flags, - 1082, NULL, NULL, &ahc_echo, "GET", + 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); @@ -109,7 +109,7 @@ testExternalGet (int flags) return 256; if (curl_uses_nss_ssl() == 0) - aes256_sha = "rsa_aes_256_sha"; + aes256_sha = "rsa_aes_256_sha"; c = curl_easy_init (); curl_easy_setopt (c, CURLOPT_URL, "https://127.0.0.1:1082/hello_world"); @@ -175,7 +175,11 @@ testExternalGet (int flags) } tv.tv_sec = 0; tv.tv_usec = 1000; - select (maxposixs + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) {