owncloud: set _fmode variable to set file ops to binary mode.
Esse commit está contido em:
@@ -779,6 +779,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\n", writeCtx->tmpFileName ));
|
||||
@@ -873,6 +882,9 @@ static int owncloud_close(csync_vio_method_handle_t *fhandle) {
|
||||
}
|
||||
|
||||
/* and open it again to read from */
|
||||
#ifdef _WIN32
|
||||
_fmode = _O_BINARY;
|
||||
#endif
|
||||
if (( writeCtx->fd = open( writeCtx->tmpFileName, O_RDONLY )) < 0) {
|
||||
errno = EIO;
|
||||
ret = -1;
|
||||
@@ -939,6 +951,9 @@ static ssize_t owncloud_read(csync_vio_method_handle_t *fhandle, void *buf, size
|
||||
|
||||
if( writeCtx->fd == -1 ) {
|
||||
/* open the downloaded file to read from */
|
||||
#ifdef _WIN32
|
||||
_fmode = _O_BINARY;
|
||||
#endif
|
||||
if (( writeCtx->fd = open( writeCtx->tmpFileName, O_RDONLY )) < 0) {
|
||||
DEBUG_WEBDAV(("Could not open local file %s\n", writeCtx->tmpFileName ));
|
||||
errno = EIO;
|
||||
|
||||
@@ -54,6 +54,9 @@ int csync_exclude_load(CSYNC *ctx, const char *fname) {
|
||||
char *buf = NULL;
|
||||
char *entry = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
_fmode = _O_BINARY;
|
||||
#endif
|
||||
fd = open(fname, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
return -1;
|
||||
|
||||
@@ -119,6 +119,9 @@ static pid_t _csync_lock_read(const char *lockfile) {
|
||||
int fd, pid;
|
||||
|
||||
/* Read PID from existing lock */
|
||||
#ifdef _WIN32
|
||||
_fmode = _O_BINARY;
|
||||
#endif
|
||||
if ((fd = open(lockfile, O_RDONLY)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,9 @@ static int _csync_statedb_check(const char *statedb) {
|
||||
sqlite3 *db = NULL;
|
||||
|
||||
/* check db version */
|
||||
#ifdef _WIN32
|
||||
_fmode = _O_BINARY;
|
||||
#endif
|
||||
fd = open(statedb, O_RDONLY);
|
||||
if (fd >= 0) {
|
||||
if (read(fd, (void *) buf, (size_t) BUF_SIZE - 1) >= 0) {
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário