Changeset 2684 for trunk/src/kmk
- Timestamp:
- Jun 19, 2013, 1:01:48 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/redirect.c
r2667 r2684 137 137 } 138 138 #endif /* _MSC_VER */ 139 140 141 #ifdef _MSC_VER 142 /** Used by safeCloseFd. */ 143 static void __cdecl ignore_invalid_parameter(const wchar_t *a, const wchar_t *b, const wchar_t *c, unsigned d, uintptr_t e) 144 { 145 } 146 #endif 147 148 149 /** 150 * Safely works around MS CRT's pedantic close() function. 151 * 152 * @param fd The file handle. 153 */ 154 static void safeCloseFd(int fd) 155 { 156 #ifdef _MSC_VER 157 _invalid_parameter_handler pfnOld = _get_invalid_parameter_handler(); 158 _set_invalid_parameter_handler(ignore_invalid_parameter); 159 close(fd); 160 _set_invalid_parameter_handler(pfnOld); 161 #else 162 close(fd); 163 #endif 164 } 139 165 140 166 … … 397 423 } 398 424 /** @todo deal with stderr */ 399 close(fd);425 safeCloseFd(fd); 400 426 continue; 401 427 } … … 602 628 * Close and open the new file descriptor. 603 629 */ 604 close(fd);630 safeCloseFd(fd); 605 631 #if defined(_MSC_VER) 606 632 if (!strcmp(psz, "/dev/null"))
Note:
See TracChangeset
for help on using the changeset viewer.