diff --git a/doc/chapters/largerpost.inc b/doc/chapters/largerpost.inc
index f1f0e060..2cf8c3c0 100644
--- a/doc/chapters/largerpost.inc
+++ b/doc/chapters/largerpost.inc
@@ -225,7 +225,7 @@ take this as the name the file will be stored on the server and make sure no fil
@verbatim
if (!con_info->fp)
{
- if (NULL != (fp = fopen (filename, "r")) )
+ if (NULL != (fp = fopen (filename, "rb")) )
{
fclose (fp);
con_info->answerstring = fileexistspage;
diff --git a/doc/examples/largepost.c b/doc/examples/largepost.c
index aadb3306..6437f036 100644
--- a/doc/examples/largepost.c
+++ b/doc/examples/largepost.c
@@ -80,7 +80,7 @@ iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key,
if (!con_info->fp)
{
- if (NULL != (fp = fopen (filename, "r")))
+ if (NULL != (fp = fopen (filename, "rb")))
{
fclose (fp);
con_info->answerstring = fileexistspage;
diff --git a/src/examples/fileserver_example.c b/src/examples/fileserver_example.c
index 83e7ab23..76a10f2f 100644
--- a/src/examples/fileserver_example.c
+++ b/src/examples/fileserver_example.c
@@ -62,7 +62,7 @@ ahc_echo (void *cls,
return MHD_YES;
}
*ptr = NULL; /* reset when done */
- file = fopen (&url[1], "r");
+ file = fopen (&url[1], "rb");
if (file == NULL)
{
response = MHD_create_response_from_data (strlen (PAGE),
diff --git a/src/examples/fileserver_example_dirs.c b/src/examples/fileserver_example_dirs.c
index e3ce7424..04519c63 100644
--- a/src/examples/fileserver_example_dirs.c
+++ b/src/examples/fileserver_example_dirs.c
@@ -55,7 +55,7 @@ dir_reader (void *cls, uint64_t pos, char *buf, int max)
return snprintf (buf, max,
"%s
",
e->d_name,
- e->d_name);
+ e->d_name);
}
@@ -83,9 +83,9 @@ ahc_echo (void *cls,
return MHD_YES;
}
*ptr = NULL; /* reset when done */
- file = fopen (&url[1], "r");
+ file = fopen (&url[1], "rb");
if (file == NULL)
- {
+ {
response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN,
32 * 1024,
&dir_reader,
diff --git a/src/examples/fileserver_example_external_select.c b/src/examples/fileserver_example_external_select.c
index d6b8fa23..6867335b 100644
--- a/src/examples/fileserver_example_external_select.c
+++ b/src/examples/fileserver_example_external_select.c
@@ -62,7 +62,7 @@ ahc_echo (void *cls,
return MHD_YES;
}
*ptr = NULL; /* reset when done */
- file = fopen (&url[1], "r");
+ file = fopen (&url[1], "rb");
if (file == NULL)
{
response = MHD_create_response_from_data (strlen (PAGE),
diff --git a/src/examples/https_fileserver_example.c b/src/examples/https_fileserver_example.c
index 030700ee..1ec88947 100644
--- a/src/examples/https_fileserver_example.c
+++ b/src/examples/https_fileserver_example.c
@@ -131,7 +131,7 @@ http_ahc (void *cls,
}
*ptr = NULL; /* reset when done */
- file = fopen (&url[1], "r");
+ file = fopen (url, "rb");
if (file == NULL)
{
response = MHD_create_response_from_data (strlen (EMPTY_PAGE),
@@ -142,7 +142,7 @@ http_ahc (void *cls,
}
else
{
- stat (&url[1], &buf);
+ stat (url, &buf);
response = MHD_create_response_from_callback (buf.st_size, 32 * 1024, /* 32k PAGE_NOT_FOUND size */
&file_reader, file,
(MHD_ContentReaderFreeCallback)
diff --git a/src/testcurl/https/tls_authentication_test.c b/src/testcurl/https/tls_authentication_test.c
index 388ceb32..9fe7318d 100644
--- a/src/testcurl/https/tls_authentication_test.c
+++ b/src/testcurl/https/tls_authentication_test.c
@@ -174,7 +174,7 @@ setup_ca_cert ()
{
FILE *cert_fd;
- if (NULL == (cert_fd = fopen (ca_cert_file_name, "w+")))
+ if (NULL == (cert_fd = fopen (ca_cert_file_name, "wb+")))
{
fprintf (stderr, "Error: failed to open `%s': %s\n",
ca_cert_file_name, strerror (errno));
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c
index 67d43ee2..ce794511 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -87,7 +87,7 @@ http_ahc (void *cls, struct MHD_Connection *connection,
}
*ptr = NULL; /* reset when done */
- file = fopen (url, "r");
+ file = fopen (url, "rb");
if (file == NULL)
{
response = MHD_create_response_from_data (strlen (PAGE_NOT_FOUND),
@@ -290,7 +290,7 @@ setup_test_file ()
{
FILE *test_fd;
- if (NULL == (test_fd = fopen (TEST_FILE_NAME, "w+")))
+ if (NULL == (test_fd = fopen (TEST_FILE_NAME, "wb+")))
{
fprintf (stderr, "Error: failed to open `%s': %s\n",
TEST_FILE_NAME, strerror (errno));