- Timestamp:
- Jan 6, 2011, 12:34:08 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/msvcrt/dir.c
r21439 r21542 62 62 #include <errno.h> 63 63 #include <stdlib.h> 64 #include <limits.h> 64 65 65 66 #ifdef __EMX__ … … 778 779 #ifdef __EMX__ 779 780 780 // The EMX version of _fullpath() returns int instead of char*, 781 // provide a wrapper 781 // The EMX version of _fullpath() returns int instead of char* and implicitly 782 // changes the current drive. It also doesn't expect absPath to be NULL and 783 // allocate a buffer in this case. Provide a wrapper to fix these issues. 782 784 char *MSVCRT__fullpath(char * absPath, const char* relPath, unsigned int size) 783 785 { 784 return _fullpath(absPath, relPath, size) == 0 ? absPath : NULL; 786 char *buf = NULL; 787 if (absPath == NULL) 788 { 789 size = PATH_MAX; 790 absPath = buf = (char *)MSVCRT_malloc(size); 791 if (buf == NULL) 792 { 793 *MSVCRT__errno() = ENOMEM; 794 return NULL; 795 } 796 } 797 798 int d = _getdrive(); 799 char *result = _fullpath(absPath, relPath, size) == 0 ? absPath : NULL; 800 _chdrive(d); 801 802 if (result == NULL && buf != NULL) 803 MSVCRT_free(buf); 804 805 return result; 785 806 } 786 807
Note:
See TracChangeset
for help on using the changeset viewer.