msvcrt: resolve symbols clashes with FreeBSD libc

Tijl Coosemans tijl at ulyssis.org
Tue Sep 18 09:33:34 CDT 2007


The patch gives the following symbols a MSVCRT_ prefix:

_access
_chdir
_chmod
_close
_creat
_dup
_dup2
_mkdir
_open
_pipe
_read
_rmdir
_sleep
_umask
_unlink
_write
wcsxfrm (stub)

---
 dlls/msvcrt/dir.c       |    6 ++--
 dlls/msvcrt/errno.c     |    8 +++---
 dlls/msvcrt/file.c      |   60 +++++++++++++++++++++++-----------------------
 dlls/msvcrt/misc.c      |    2 +-
 dlls/msvcrt/msvcrt.h    |   10 ++++----
 dlls/msvcrt/msvcrt.spec |   34 +++++++++++++-------------
 dlls/msvcrt/process.c   |   32 ++++++++++++------------
 7 files changed, 76 insertions(+), 76 deletions(-)
-------------- next part --------------
diff --git a/dlls/msvcrt/dir.c b/dlls/msvcrt/dir.c
index 8340d28..06013c6 100644
--- a/dlls/msvcrt/dir.c
+++ b/dlls/msvcrt/dir.c
@@ -131,7 +131,7 @@ static void msvcrt_wfttofdi64( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfindd
  * NOTES
  *  See SetCurrentDirectoryA.
  */
-int CDECL _chdir(const char * newdir)
+int CDECL MSVCRT__chdir(const char * newdir)
 {
   if (!SetCurrentDirectoryA(newdir))
   {
@@ -627,7 +627,7 @@ unsigned int CDECL MSVCRT__getdiskfree(unsigned int disk, struct MSVCRT__diskfre
  * NOTES
  *  See CreateDirectoryA.
  */
-int CDECL _mkdir(const char * newdir)
+int CDECL MSVCRT__mkdir(const char * newdir)
 {
   if (CreateDirectoryA(newdir,NULL))
     return 0;
@@ -663,7 +663,7 @@ int CDECL _wmkdir(const MSVCRT_wchar_t* newdir)
  * NOTES
  *  See RemoveDirectoryA.
  */
-int CDECL _rmdir(const char * dir)
+int CDECL MSVCRT__rmdir(const char * dir)
 {
   if (RemoveDirectoryA(dir))
     return 0;
diff --git a/dlls/msvcrt/errno.c b/dlls/msvcrt/errno.c
index 59d0541..1b5fd96 100644
--- a/dlls/msvcrt/errno.c
+++ b/dlls/msvcrt/errno.c
@@ -241,11 +241,11 @@ void CDECL MSVCRT_perror(const char* str)
 
     if (str && *str)
     {
-        _write( 2, str, strlen(str) );
-        _write( 2, ": ", 2 );
+        MSVCRT__write( 2, str, strlen(str) );
+        MSVCRT__write( 2, ": ", 2 );
     }
-    _write( 2, MSVCRT__sys_errlist[err], strlen(MSVCRT__sys_errlist[err]) );
-    _write( 2, "\n", 1 );
+    MSVCRT__write( 2, MSVCRT__sys_errlist[err], strlen(MSVCRT__sys_errlist[err]) );
+    MSVCRT__write( 2, "\n", 1 );
 }
 
 /******************************************************************************
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 805bc55..83c64c9 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -400,7 +400,7 @@ static int msvcrt_flush_buffer(MSVCRT_FILE* file)
 {
   if(file->_bufsiz) {
         int cnt=file->_ptr-file->_base;
-        if(cnt>0 && _write(file->_file, file->_base, cnt) != cnt) {
+        if(cnt>0 && MSVCRT__write(file->_file, file->_base, cnt) != cnt) {
             file->_flag |= MSVCRT__IOERR;
             return MSVCRT_EOF;
         }
@@ -460,7 +460,7 @@ MSVCRT_FILE * CDECL __p__iob(void)
 /*********************************************************************
  *		_access (MSVCRT.@)
  */
-int CDECL _access(const char *filename, int mode)
+int CDECL MSVCRT__access(const char *filename, int mode)
 {
   DWORD attr = GetFileAttributesA(filename);
 
@@ -504,7 +504,7 @@ int CDECL _waccess(const MSVCRT_wchar_t *filename, int mode)
 /*********************************************************************
  *		_chmod (MSVCRT.@)
  */
-int CDECL _chmod(const char *path, int flags)
+int CDECL MSVCRT__chmod(const char *path, int flags)
 {
   DWORD oldFlags = GetFileAttributesA(path);
 
@@ -542,7 +542,7 @@ int CDECL _wchmod(const MSVCRT_wchar_t *path, int flags)
 /*********************************************************************
  *		_unlink (MSVCRT.@)
  */
-int CDECL _unlink(const char *path)
+int CDECL MSVCRT__unlink(const char *path)
 {
   TRACE("%s\n",debugstr_a(path));
   if(DeleteFileA(path))
@@ -613,7 +613,7 @@ int CDECL MSVCRT_fflush(MSVCRT_FILE* file)
 /*********************************************************************
  *		_close (MSVCRT.@)
  */
-int CDECL _close(int fd)
+int CDECL MSVCRT__close(int fd)
 {
   HANDLE hand;
   int ret;
@@ -675,7 +675,7 @@ int CDECL _commit(int fd)
  * indicate file descriptors duplicated with _dup and _dup2 are always
  * inheritable.
  */
-int CDECL _dup2(int od, int nd)
+int CDECL MSVCRT__dup2(int od, int nd)
 {
   int ret;
 
@@ -691,7 +691,7 @@ int CDECL _dup2(int od, int nd)
       int wxflag = MSVCRT_fdesc[od].wxflag & ~MSVCRT__O_NOINHERIT;
 
       if (msvcrt_is_valid_fd(nd))
-        _close(nd);
+        MSVCRT__close(nd);
       ret = msvcrt_alloc_fd_from(handle, wxflag, nd);
       if (ret == -1)
       {
@@ -722,13 +722,13 @@ int CDECL _dup2(int od, int nd)
 /*********************************************************************
  *		_dup (MSVCRT.@)
  */
-int CDECL _dup(int od)
+int CDECL MSVCRT__dup(int od)
 {
   int fd, ret;
  
   LOCK_FILES();
   fd = MSVCRT_fdstart;
-  if (_dup2(od, fd) == 0)
+  if (MSVCRT__dup2(od, fd) == 0)
     ret = fd;
   else
     ret = -1;
@@ -1359,7 +1359,7 @@ static unsigned split_oflags(unsigned oflags)
 /*********************************************************************
  *              _pipe (MSVCRT.@)
  */
-int CDECL _pipe(int *pfds, unsigned int psize, int textmode)
+int CDECL MSVCRT__pipe(int *pfds, unsigned int psize, int textmode)
 {
   int ret = -1;
   SECURITY_ATTRIBUTES sa;
@@ -1392,7 +1392,7 @@ int CDECL _pipe(int *pfds, unsigned int psize, int textmode)
       }
       else
       {
-        _close(pfds[0]);
+        MSVCRT__close(pfds[0]);
         CloseHandle(writeHandle);
         *MSVCRT__errno() = MSVCRT_EMFILE;
       }
@@ -1535,7 +1535,7 @@ int CDECL MSVCRT__wsopen( const MSVCRT_wchar_t* path, int oflags, int shflags, .
 /*********************************************************************
  *              _open (MSVCRT.@)
  */
-int CDECL _open( const char *path, int flags, ... )
+int CDECL MSVCRT__open( const char *path, int flags, ... )
 {
   va_list ap;
 
@@ -1567,7 +1567,7 @@ int CDECL _wopen(const MSVCRT_wchar_t *path,int flags,...)
 
   if (patha && WideCharToMultiByte(CP_ACP,0,path,len,patha,len,NULL,NULL))
   {
-    int retval = _open(patha,flags,pmode);
+    int retval = MSVCRT__open(patha,flags,pmode);
     MSVCRT_free(patha);
     return retval;
   }
@@ -1579,10 +1579,10 @@ int CDECL _wopen(const MSVCRT_wchar_t *path,int flags,...)
 /*********************************************************************
  *		_creat (MSVCRT.@)
  */
-int CDECL _creat(const char *path, int flags)
+int CDECL MSVCRT__creat(const char *path, int flags)
 {
   int usedFlags = (flags & MSVCRT__O_TEXT)| MSVCRT__O_CREAT| MSVCRT__O_WRONLY| MSVCRT__O_TRUNC;
-  return _open(path, usedFlags);
+  return MSVCRT__open(path, usedFlags);
 }
 
 /*********************************************************************
@@ -1712,7 +1712,7 @@ static int read_i(int fd, void *buf, unsigned int count)
 /*********************************************************************
  *		_read (MSVCRT.@)
  */
-int CDECL _read(int fd, void *buf, unsigned int count)
+int CDECL MSVCRT__read(int fd, void *buf, unsigned int count)
 {
   int num_read;
   num_read = read_i(fd, buf, count);
@@ -1978,7 +1978,7 @@ MSVCRT_wchar_t * CDECL _wtempnam(const MSVCRT_wchar_t *dir, const MSVCRT_wchar_t
 /*********************************************************************
  *		_umask (MSVCRT.@)
  */
-int CDECL _umask(int umask)
+int CDECL MSVCRT__umask(int umask)
 {
   int old_umask = MSVCRT_umask;
   TRACE("(%d)\n",umask);
@@ -1991,12 +1991,12 @@ int CDECL _umask(int umask)
  */
 int CDECL _utime(const char* path, struct MSVCRT__utimbuf *t)
 {
-  int fd = _open(path, MSVCRT__O_WRONLY | MSVCRT__O_BINARY);
+  int fd = MSVCRT__open(path, MSVCRT__O_WRONLY | MSVCRT__O_BINARY);
 
   if (fd > 0)
   {
     int retVal = _futime(fd, t);
-    _close(fd);
+    MSVCRT__close(fd);
     return retVal;
   }
   return -1;
@@ -2012,7 +2012,7 @@ int CDECL _wutime(const MSVCRT_wchar_t* path, struct MSVCRT__utimbuf *t)
   if (fd > 0)
   {
     int retVal = _futime(fd, t);
-    _close(fd);
+    MSVCRT__close(fd);
     return retVal;
   }
   return -1;
@@ -2021,7 +2021,7 @@ int CDECL _wutime(const MSVCRT_wchar_t* path, struct MSVCRT__utimbuf *t)
 /*********************************************************************
  *		_write (MSVCRT.@)
  */
-int CDECL _write(int fd, const void* buf, unsigned int count)
+int CDECL MSVCRT__write(int fd, const void* buf, unsigned int count)
 {
   DWORD num_written;
   HANDLE hand = msvcrt_fdtoh(fd);
@@ -2114,7 +2114,7 @@ int CDECL _write(int fd, const void* buf, unsigned int count)
 int CDECL MSVCRT__putw(int val, MSVCRT_FILE* file)
 {
   int len;
-  len = _write(file->_file, &val, sizeof(val));
+  len = MSVCRT__write(file->_file, &val, sizeof(val));
   if (len == sizeof(val)) return val;
   file->_flag |= MSVCRT__IOERR;
   return MSVCRT_EOF;
@@ -2136,7 +2136,7 @@ int CDECL MSVCRT_fclose(MSVCRT_FILE* file)
   if(file->_flag & MSVCRT__IOMYBUF)
       MSVCRT_free(file->_base);
 
-  r=_close(file->_file);
+  r=MSVCRT__close(file->_file);
 
   file->_flag = 0;
 
@@ -2399,7 +2399,7 @@ MSVCRT_size_t CDECL MSVCRT_fwrite(const void *ptr, MSVCRT_size_t size, MSVCRT_si
 	/* Flush buffer */
   	int res=msvcrt_flush_buffer(file);
 	if(!res) {
-		int pwritten = _write(file->_file, ptr, wrcnt);
+		int pwritten = MSVCRT__write(file->_file, ptr, wrcnt);
   		if (pwritten <= 0)
                 {
                     file->_flag |= MSVCRT__IOERR;
@@ -2459,7 +2459,7 @@ MSVCRT_FILE * CDECL MSVCRT__fsopen(const char *path, const char *mode, int share
 
   TRACE(":got (%p)\n",file);
   if (fd >= 0 && !file)
-    _close(fd);
+    MSVCRT__close(fd);
   UNLOCK_FILES();
   return file;
 }
@@ -2550,7 +2550,7 @@ int CDECL MSVCRT__flsbuf(int c, MSVCRT_FILE* file)
   } else {
 	unsigned char cc=c;
         int len;
-  	len = _write(file->_file, &cc, 1);
+  	len = MSVCRT__write(file->_file, &cc, 1);
         if (len == 1) return c;
         file->_flag |= MSVCRT__IOERR;
         return MSVCRT_EOF;
@@ -2603,7 +2603,7 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
       if (file->_bufsiz == 0) {
         msvcrt_alloc_buffer(file);
       }
-      file->_cnt = _read(file->_file, file->_base, file->_bufsiz);
+      file->_cnt = MSVCRT__read(file->_file, file->_base, file->_bufsiz);
       file->_ptr = file->_base;
       i = (file->_cnt<rcnt) ? file->_cnt : rcnt;
       /* If the buffer fill reaches eof but fread wouldn't, clear eof. */
@@ -2617,7 +2617,7 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
         file->_ptr += i;
       }
     } else {
-      i = _read(file->_file,ptr, rcnt);
+      i = MSVCRT__read(file->_file,ptr, rcnt);
     }
     pread += i;
     rcnt -= i;
@@ -2660,7 +2660,7 @@ MSVCRT_FILE* CDECL MSVCRT_freopen(const char *path, const char *mode,MSVCRT_FILE
       file = NULL;
     else
     {
-      fd = _open(path, open_flags, MSVCRT__S_IREAD | MSVCRT__S_IWRITE);
+      fd = MSVCRT__open(path, open_flags, MSVCRT__S_IREAD | MSVCRT__S_IWRITE);
       if (fd < 0)
         file = NULL;
       else if (msvcrt_init_fp(file, fd, stream_flags) == -1)
@@ -2980,7 +2980,7 @@ MSVCRT_FILE* CDECL MSVCRT_tmpfile(void)
   MSVCRT_FILE* file = NULL;
 
   LOCK_FILES();
-  fd = _open(filename, MSVCRT__O_CREAT | MSVCRT__O_BINARY | MSVCRT__O_RDWR | MSVCRT__O_TEMPORARY);
+  fd = MSVCRT__open(filename, MSVCRT__O_CREAT | MSVCRT__O_BINARY | MSVCRT__O_RDWR | MSVCRT__O_TEMPORARY);
   if (fd != -1 && (file = msvcrt_alloc_fp()))
   {
     if (msvcrt_init_fp(file, fd, MSVCRT__O_RDWR) == -1)
diff --git a/dlls/msvcrt/misc.c b/dlls/msvcrt/misc.c
index bb6d1f0..cba6aa8 100644
--- a/dlls/msvcrt/misc.c
+++ b/dlls/msvcrt/misc.c
@@ -63,7 +63,7 @@ int CDECL MSVCRT_rand(void)
 /*********************************************************************
  *		_sleep (MSVCRT.@)
  */
-void CDECL _sleep(unsigned long timeout)
+void CDECL MSVCRT__sleep(unsigned long timeout)
 {
   TRACE("_sleep for %ld milliseconds\n",timeout);
   Sleep((timeout)?timeout:1);
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 587d9e8..3a9d5c3 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -627,7 +627,7 @@ int            MSVCRT_vsnwprintf(MSVCRT_wchar_t *str, unsigned int len,
 int            MSVCRT_raise(int sig);
 
 #ifndef __WINE_MSVCRT_TEST
-int            _write(int,const void*,unsigned int);
+int            MSVCRT__write(int,const void*,unsigned int);
 int            _getch(void);
 int            _ismbstrail(const unsigned char* start, const unsigned char* str);
 MSVCRT_intptr_t _spawnve(int,const char*,const char* const *,const char* const *);
@@ -647,10 +647,10 @@ MSVCRT_wchar_t*** __p__wenviron(void);
 char*         _strdate(char* date);
 char*         _strtime(char* date);
 void          _ftime(struct MSVCRT__timeb *buf);
-int           _close(int);
-int           _dup(int);
-int           _dup2(int, int);
-int           _pipe(int *, unsigned int, int);
+int           MSVCRT__close(int);
+int           MSVCRT__dup(int);
+int           MSVCRT__dup2(int, int);
+int           MSVCRT__pipe(int *, unsigned int, int);
 #endif
 
 #endif /* __WINE_MSVCRT_H */
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index 1a516f0..559124f 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -146,7 +146,7 @@
 @ cdecl __wgetmainargs(ptr ptr ptr long ptr)
 @ extern __winitenv MSVCRT___winitenv
 @ cdecl _abnormal_termination()
-@ cdecl _access(str long)
+@ cdecl _access(str long) MSVCRT__access
 @ extern _acmdln MSVCRT__acmdln
 @ stdcall _adj_fdiv_m16i(long)
 @ stdcall _adj_fdiv_m32(long)
@@ -181,14 +181,14 @@
 @ cdecl _callnewh(long)
 @ cdecl _cexit() MSVCRT__cexit
 @ cdecl _cgets(str)
-@ cdecl _chdir(str)
+@ cdecl _chdir(str) MSVCRT__chdir
 @ cdecl _chdrive(long)
 @ cdecl _chgsign( double )
 @ cdecl -i386 -norelay _chkesp()
-@ cdecl _chmod(str long)
+@ cdecl _chmod(str long) MSVCRT__chmod
 @ cdecl _chsize (long long)
 @ cdecl _clearfp()
-@ cdecl _close(long)
+@ cdecl _close(long) MSVCRT__close
 @ cdecl _commit(long)
 @ extern _commode MSVCRT__commode
 @ cdecl _control87(long long)
@@ -196,14 +196,14 @@
 @ cdecl _copysign( double double )
 @ varargs _cprintf(str)
 @ cdecl _cputs(str)
-@ cdecl _creat(str long)
+@ cdecl _creat(str long) MSVCRT__creat
 @ varargs _cscanf(str)
 @ extern _ctype MSVCRT__ctype
 @ cdecl _cwait(ptr long long)
 @ extern _daylight MSVCRT___daylight
 @ extern _dstbias MSVCRT__dstbias
-@ cdecl _dup (long)
-@ cdecl _dup2 (long long)
+@ cdecl _dup (long) MSVCRT__dup
+@ cdecl _dup2 (long long) MSVCRT__dup2
 @ cdecl _ecvt(double long ptr ptr)
 @ cdecl _endthread ()
 @ cdecl _endthreadex(long)
@@ -399,12 +399,12 @@
 @ cdecl _mbsupr(str)
 @ cdecl _memccpy(ptr ptr long long) ntdll._memccpy
 @ cdecl _memicmp(str str long) ntdll._memicmp
-@ cdecl _mkdir(str)
+@ cdecl _mkdir(str) MSVCRT__mkdir
 @ cdecl _mktemp(str)
 @ cdecl _msize(ptr)
 @ cdecl _nextafter(double double)
 @ cdecl _onexit(ptr) MSVCRT__onexit
-@ varargs _open(str long)
+@ varargs _open(str long) MSVCRT__open
 @ cdecl _open_osfhandle(long long)
 @ extern _osver MSVCRT__osver
 @ stub _outp #(long long)
@@ -413,7 +413,7 @@
 @ cdecl _pclose (ptr) MSVCRT__pclose
 @ extern _pctype MSVCRT__pctype
 @ extern _pgmptr MSVCRT__pgmptr
-@ cdecl _pipe (ptr long long)
+@ cdecl _pipe (ptr long long) MSVCRT__pipe
 @ cdecl _popen (str str) MSVCRT__popen
 @ cdecl _purecall()
 @ cdecl _putch(long)
@@ -421,8 +421,8 @@
 @ cdecl _putw(long ptr) MSVCRT__putw
 @ cdecl _putws(wstr)
 # extern _pwctype
-@ cdecl _read(long ptr long)
-@ cdecl _rmdir(str)
+@ cdecl _read(long ptr long) MSVCRT__read
+@ cdecl _rmdir(str) MSVCRT__rmdir
 @ cdecl _rmtmp()
 @ cdecl _rotl(long long)
 @ cdecl _rotr(long long)
@@ -442,7 +442,7 @@
 @ cdecl _setmbcp(long)
 @ cdecl _setmode(long long)
 @ stub _setsystime #(ptr long)
-@ cdecl _sleep(long)
+@ cdecl _sleep(long) MSVCRT__sleep
 @ varargs _snprintf(str long str) MSVCRT__snprintf
 @ varargs _snwprintf(wstr long wstr) MSVCRT__snwprintf
 @ varargs _sopen(str long long) MSVCRT__sopen
@@ -489,9 +489,9 @@
 @ cdecl _ui64tow(long long ptr long) ntdll._ui64tow
 @ cdecl _ultoa(long ptr long) ntdll._ultoa
 @ cdecl _ultow(long ptr long) ntdll._ultow
-@ cdecl _umask(long)
+@ cdecl _umask(long) MSVCRT__umask
 @ cdecl _ungetch(long)
-@ cdecl _unlink(str)
+@ cdecl _unlink(str) MSVCRT__unlink
 @ cdecl _unloaddll(long)
 @ cdecl _unlock(long)
 @ cdecl _utime(str ptr)
@@ -549,7 +549,7 @@
 @ cdecl _wputenv(wstr)
 @ cdecl _wremove(wstr)
 @ cdecl _wrename(wstr wstr)
-@ cdecl _write(long ptr long)
+@ cdecl _write(long ptr long) MSVCRT__write
 @ cdecl _wrmdir(wstr)
 @ stub _wsearchenv #(wstr wstr ptr)
 @ cdecl _wsetlocale(long wstr) MSVCRT__wsetlocale
@@ -770,7 +770,7 @@
 @ cdecl wcstol(wstr ptr long) ntdll.wcstol
 @ cdecl wcstombs(ptr ptr long) ntdll.wcstombs
 @ cdecl wcstoul(wstr ptr long) ntdll.wcstoul
-@ stub wcsxfrm #(ptr wstr long)
+@ stub wcsxfrm #(ptr wstr long) MSVCRT_wcsxfrm
 @ cdecl wctomb(ptr long) MSVCRT_wctomb
 @ varargs wprintf(wstr) MSVCRT_wprintf
 @ varargs wscanf(wstr) MSVCRT_wscanf
diff --git a/dlls/msvcrt/process.c b/dlls/msvcrt/process.c
index c70b6f7..c6c3a7e 100644
--- a/dlls/msvcrt/process.c
+++ b/dlls/msvcrt/process.c
@@ -565,25 +565,25 @@ MSVCRT_FILE* CDECL MSVCRT__popen(const char* command, const char* mode)
         break;
     }
   }
-  if (_pipe(fds, 0, textmode) == -1)
+  if (MSVCRT__pipe(fds, 0, textmode) == -1)
     return NULL;
 
   fdToDup = readPipe ? 1 : 0;
   fdToOpen = readPipe ? 0 : 1;
 
-  if ((fdStdHandle = _dup(fdToDup)) == -1)
+  if ((fdStdHandle = MSVCRT__dup(fdToDup)) == -1)
     goto error;
-  if (_dup2(fds[fdToDup], fdToDup) != 0)
+  if (MSVCRT__dup2(fds[fdToDup], fdToDup) != 0)
     goto error;
   if (readPipe)
   {
-    if ((fdStdErr = _dup(MSVCRT_STDERR_FILENO)) == -1)
+    if ((fdStdErr = MSVCRT__dup(MSVCRT_STDERR_FILENO)) == -1)
       goto error;
-    if (_dup2(fds[fdToDup], MSVCRT_STDERR_FILENO) != 0)
+    if (MSVCRT__dup2(fds[fdToDup], MSVCRT_STDERR_FILENO) != 0)
       goto error;
   }
 
-  _close(fds[fdToDup]);
+  MSVCRT__close(fds[fdToDup]);
 
   comSpecLen = GetEnvironmentVariableA(comSpec, NULL, 0);
   if (!comSpecLen)
@@ -596,30 +596,30 @@ MSVCRT_FILE* CDECL MSVCRT__popen(const char* command, const char* mode)
   strcat(cmdcopy, command);
   if (msvcrt_spawn(MSVCRT__P_NOWAIT, NULL, cmdcopy, NULL) == -1)
   {
-    _close(fds[fdToOpen]);
+    MSVCRT__close(fds[fdToOpen]);
     ret = NULL;
   }
   else
   {
     ret = MSVCRT__fdopen(fds[fdToOpen], mode);
     if (!ret)
-      _close(fds[fdToOpen]);
+      MSVCRT__close(fds[fdToOpen]);
   }
   HeapFree(GetProcessHeap(), 0, cmdcopy);
-  _dup2(fdStdHandle, fdToDup);
-  _close(fdStdHandle);
+  MSVCRT__dup2(fdStdHandle, fdToDup);
+  MSVCRT__close(fdStdHandle);
   if (readPipe)
   {
-    _dup2(fdStdErr, MSVCRT_STDERR_FILENO);
-    _close(fdStdErr);
+    MSVCRT__dup2(fdStdErr, MSVCRT_STDERR_FILENO);
+    MSVCRT__close(fdStdErr);
   }
   return ret;
 
 error:
-  if (fdStdHandle != -1) _close(fdStdHandle);
-  if (fdStdErr != -1)    _close(fdStdErr);
-  _close(fds[0]);
-  _close(fds[1]);
+  if (fdStdHandle != -1) MSVCRT__close(fdStdHandle);
+  if (fdStdErr != -1)    MSVCRT__close(fdStdErr);
+  MSVCRT__close(fds[0]);
+  MSVCRT__close(fds[1]);
   return NULL;
 }
 


More information about the wine-patches mailing list