aboutsummaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorkinichiro <kinichiro.inoguchi@gmail.com>2019-07-26 22:26:13 +0900
committerkinichiro <kinichiro.inoguchi@gmail.com>2019-07-26 22:26:13 +0900
commit0e3d93fc1d008d7561e97ceccc35f092e5fc0f36 (patch)
tree9bbd0a3e9393d86c3490bf2efe3f39fa335a08b4 /patches
parent30e91bc6d2b6249da1c8c40582c63601a4838efc (diff)
downloadportable-0e3d93fc1d008d7561e97ceccc35f092e5fc0f36.tar.gz
portable-0e3d93fc1d008d7561e97ceccc35f092e5fc0f36.tar.bz2
portable-0e3d93fc1d008d7561e97ceccc35f092e5fc0f36.zip
Force binary mode for open() on WIN32
Reported by @ulfworsoe https://github.com/libressl-portable/portable/issues/542
Diffstat (limited to 'patches')
-rw-r--r--patches/tls_config.c.patch16
-rw-r--r--patches/tls_util.c.patch16
2 files changed, 28 insertions, 4 deletions
diff --git a/patches/tls_config.c.patch b/patches/tls_config.c.patch
index 5702a58..cd9817c 100644
--- a/patches/tls_config.c.patch
+++ b/patches/tls_config.c.patch
@@ -1,5 +1,5 @@
1--- tls/tls_config.c.orig Sun Mar 18 00:29:59 2018 1--- tls/tls_config.c.orig Fri Jul 26 22:16:53 2019
2+++ tls/tls_config.c Sun Mar 18 00:30:51 2018 2+++ tls/tls_config.c Fri Jul 26 22:21:25 2019
3@@ -15,6 +15,10 @@ 3@@ -15,6 +15,10 @@
4 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 4 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
5 */ 5 */
@@ -11,3 +11,15 @@
11 #include <sys/stat.h> 11 #include <sys/stat.h>
12 12
13 #include <ctype.h> 13 #include <ctype.h>
14@@ -48,7 +52,11 @@ tls_config_load_file(struct tls_error *error, const ch
15 *buf = NULL;
16 *len = 0;
17
18+#ifndef _WIN32
19 if ((fd = open(filename, O_RDONLY)) == -1) {
20+#else
21+ if ((fd = open(filename, O_RDONLY | O_BINARY)) == -1) {
22+#endif
23 tls_error_set(error, "failed to open %s file '%s'",
24 filetype, filename);
25 goto err;
diff --git a/patches/tls_util.c.patch b/patches/tls_util.c.patch
index 10f2f99..9f57d83 100644
--- a/patches/tls_util.c.patch
+++ b/patches/tls_util.c.patch
@@ -1,5 +1,5 @@
1--- tls/tls_util.c.orig Sun Mar 18 00:30:07 2018 1--- tls/tls_util.c.orig Fri Jul 26 22:17:04 2019
2+++ tls/tls_util.c Sun Mar 18 00:31:09 2018 2+++ tls/tls_util.c Fri Jul 26 22:21:22 2019
3@@ -17,6 +17,10 @@ 3@@ -17,6 +17,10 @@
4 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 4 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
5 */ 5 */
@@ -11,3 +11,15 @@
11 #include <sys/stat.h> 11 #include <sys/stat.h>
12 12
13 #include <stdlib.h> 13 #include <stdlib.h>
14@@ -161,7 +165,11 @@ tls_load_file(const char *name, size_t *len, char *pas
15
16 *len = 0;
17
18+#ifndef _WIN32
19 if ((fd = open(name, O_RDONLY)) == -1)
20+#else
21+ if ((fd = open(name, O_RDONLY | O_BINARY)) == -1)
22+#endif
23 return (NULL);
24
25 /* Just load the file into memory without decryption */