From a78f3a089160ca36f350d8be2635bb364fed9ed9 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 22 May 2022 13:39:27 +0200 Subject: [PATCH] [http] Fix issue with uploading files on DOS --- src/protocol/http/post.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/protocol/http/post.c b/src/protocol/http/post.c index c4e531e3..2a889707 100644 --- a/src/protocol/http/post.c +++ b/src/protocol/http/post.c @@ -149,6 +149,10 @@ open_http_post(struct http_post *http_post, const char *post_data, return 1; } +#ifndef O_BINARY +#define O_BINARY 0 +#endif + /** @return -2 if no data was read but the caller should retry; * -1 if an error occurred and *@a error was set; 0 at end of data; * a positive number if that many bytes were read. @@ -192,7 +196,7 @@ read_http_post_inline(struct http_post *http_post, end = strchr((post + 1), FILE_CHAR); assert(end); http_post->post_fd = open(http_post->files[http_post->file_index].name, - O_RDONLY); + O_RDONLY|O_BINARY); /* Be careful not to change errno here. */ if (http_post->post_fd < 0) { http_post->post_data = post;