Merge "Replace HAVE_MS_C_RUNTIME with _WIN32 in build."

This commit is contained in:
Elliott Hughes 2015-08-17 20:25:36 +00:00 committed by Gerrit Code Review
commit 648f2011a6
1 changed files with 4 additions and 7 deletions

View File

@ -24,11 +24,8 @@
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
#ifdef HAVE_MS_C_RUNTIME
# define mkdir(path,mode) _mkdir(path)
#endif
#if defined(_WIN32) #if defined(_WIN32)
# define mkdir(path,mode) _mkdir(path)
# define S_ISLNK(s) 0 # define S_ISLNK(s) 0
# define lstat stat # define lstat stat
# ifndef EACCESS /* seems to be missing from the Mingw headers */ # ifndef EACCESS /* seems to be missing from the Mingw headers */
@ -183,7 +180,7 @@ static int setPermissions(const char* dst, const struct stat* pSrcStat, unsigned
DBUG(("--- unable to set perms on '%s' to 0%o: %s\n", DBUG(("--- unable to set perms on '%s' to 0%o: %s\n",
dst, pSrcStat->st_mode & ~(S_IFMT), strerror(errno))); dst, pSrcStat->st_mode & ~(S_IFMT), strerror(errno)));
} }
#ifndef HAVE_MS_C_RUNTIME #ifndef _WIN32
/* /*
* Set the owner. * Set the owner.
*/ */
@ -261,7 +258,7 @@ static int copyRegular(const char* src, const char* dst, const struct stat* pSrc
/* if "force" is set, try removing the destination file and retry */ /* if "force" is set, try removing the destination file and retry */
if (options & COPY_FORCE) { if (options & COPY_FORCE) {
if (unlink(dst) != 0) { if (unlink(dst) != 0) {
#ifdef HAVE_MS_C_RUNTIME #ifdef _WIN32
/* MSVCRT.DLL unlink will fail with EACCESS if the file is set read-only */ /* MSVCRT.DLL unlink will fail with EACCESS if the file is set read-only */
/* so try to change its mode, and unlink again */ /* so try to change its mode, and unlink again */
if (errno == EACCESS) { if (errno == EACCESS) {
@ -274,7 +271,7 @@ static int copyRegular(const char* src, const char* dst, const struct stat* pSrc
(void) close(srcFd); (void) close(srcFd);
return -1; return -1;
} }
#ifdef HAVE_MS_C_RUNTIME #ifdef _WIN32
Open_File: Open_File:
#endif #endif
dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644); dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644);