GUACAMOLE-325: Do not lock files on Windows. Use Windows-specific _mkdir() call 
where necessary.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/d85f61de
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/d85f61de
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/d85f61de

Branch: refs/heads/master
Commit: d85f61deaf3ab09b9ce129a49e8476aa158cce70
Parents: 1c404d1
Author: Michael Jumper <[email protected]>
Authored: Mon Jun 12 12:23:51 2017 -0700
Committer: Michael Jumper <[email protected]>
Committed: Wed Jul 5 20:55:02 2017 -0700

----------------------------------------------------------------------
 src/common/recording.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/d85f61de/src/common/recording.c
----------------------------------------------------------------------
diff --git a/src/common/recording.c b/src/common/recording.c
index 2c953b5..6b1dccc 100644
--- a/src/common/recording.c
+++ b/src/common/recording.c
@@ -22,6 +22,10 @@
 #include <guacamole/client.h>
 #include <guacamole/socket.h>
 
+#ifdef __MINGW32__
+#include <direct.h>
+#endif
+
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <errno.h>
@@ -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;

Reply via email to