From d85f61deaf3ab09b9ce129a49e8476aa158cce70 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 12 Jun 2017 12:23:51 -0700 Subject: [PATCH] GUACAMOLE-325: Do not lock files on Windows. Use Windows-specific _mkdir() call where necessary. --- src/common/recording.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/common/recording.c b/src/common/recording.c index 2c953b5a..6b1dcccc 100644 --- a/src/common/recording.c +++ b/src/common/recording.c @@ -22,6 +22,10 @@ #include #include +#ifdef __MINGW32__ +#include +#endif + #include #include #include @@ -107,6 +111,8 @@ static int guac_common_recording_open(const char* path, } /* end if open succeeded */ +/* Explicit file locks are required only on POSIX platforms */ +#ifndef __MINGW32__ /* Lock entire output file for writing by the current process */ struct flock file_lock = { .l_type = F_WRLCK, @@ -121,6 +127,7 @@ static int guac_common_recording_open(const char* path, close(fd); return -1; } +#endif return fd; @@ -132,7 +139,11 @@ int guac_common_recording_create(guac_client* client, const char* path, char filename[GUAC_COMMON_RECORDING_MAX_NAME_LENGTH]; /* Create path if it does not exist, fail if impossible */ +#ifndef __MINGW32__ if (create_path && mkdir(path, S_IRWXU) && errno != EEXIST) { +#else + if (create_path && _mkdir(path) && errno != EEXIST) { +#endif guac_client_log(client, GUAC_LOG_ERROR, "Creation of recording failed: %s", strerror(errno)); return 1;