X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/cfeed4da95fd8c38eadab32c9d897302e73d5a91..3267d6a9ceeefad438080b17c02daa7775820803:/syscall.c diff --git a/syscall.c b/syscall.c index cbc5e537..600d91c4 100644 --- a/syscall.c +++ b/syscall.c @@ -90,7 +90,7 @@ int do_rmdir(char *pathname) int do_open(char *pathname, int flags, mode_t mode) { if (flags != O_RDONLY) { - RETURN_ERROR_IF(dry_run, ENOMSG); + RETURN_ERROR_IF(dry_run, 0); RETURN_ERROR_IF_RO_OR_LO; } @@ -149,10 +149,10 @@ int do_mkdir(char *fname, mode_t mode) /* like mkstemp but forces permissions */ int do_mkstemp(char *template, mode_t perms) { - RETURN_ERROR_IF(dry_run, ENOMSG); + RETURN_ERROR_IF(dry_run, 0); RETURN_ERROR_IF(read_only, EROFS); -#if defined(HAVE_SECURE_MKSTEMP) && defined(HAVE_FCHMOD) +#if HAVE_SECURE_MKSTEMP && HAVE_FCHMOD && (!HAVE_OPEN64 || HAVE_MKSTEMP64) { int fd = mkstemp(template); if (fd == -1) @@ -164,6 +164,9 @@ int do_mkstemp(char *template, mode_t perms) errno = errno_save; return -1; } +#if HAVE_SETMODE && O_BINARY + setmode(fd, O_BINARY); +#endif return fd; } #else