From eedd1d086bf51271b97363c67dd9d7a0b2362c2e Mon Sep 17 00:00:00 2001 From: Kurt Kiessling Date: Mon, 22 Jan 2024 15:04:02 +0100 Subject: [PATCH] fix caching files as binary on windows (e.g. when using WAV files) --- src/mod/applications/mod_httapi/mod_httapi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 1254a6f93c..762b20292d 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -2501,7 +2501,11 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char if (save_path) { while(--tries && (client->fd == 0 || client->fd == -1)) { + #ifdef WIN32 + client->fd = open(save_path, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR); + #else client->fd = open(save_path, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR); + #endif } if (client->fd < 0) {