From d50f39c8b81c34e8f53c0859ea84ca802d5f0bae Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Wed, 7 Mar 2012 14:46:47 +0100 Subject: [PATCH] owncloud: Win32 use c_tmpname and set _fmode to O_BINARY. --- modules/csync_owncloud.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/csync_owncloud.c b/modules/csync_owncloud.c index 0726c9071..43d86192c 100644 --- a/modules/csync_owncloud.c +++ b/modules/csync_owncloud.c @@ -964,6 +964,15 @@ static csync_vio_method_handle_t *owncloud_open(const char *durl, } #else writeCtx->tmpFileName = c_strdup( "/tmp/csync.XXXXXX" ); +#ifdef _WIN32 + if( c_tmpname( writeCtx->tmpFileName ) == 0 ) { + _fmode = _O_BINARY; + + writeCtx->fd = open( writeCtx->tmpFileName, O_RDWR | O_CREAT | O_EXCL, 0600 ); + } else { + writeCtx->fd = -1; + } +#else writeCtx->fd = mkstemp( writeCtx->tmpFileName ); #endif DEBUG_WEBDAV("opening temp directory %s: %d", writeCtx->tmpFileName, writeCtx->fd );