diff options
Diffstat (limited to 'win32/win32sck.c')
-rw-r--r-- | win32/win32sck.c | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/win32/win32sck.c b/win32/win32sck.c index f08b7bea29..4edd1407a4 100644 --- a/win32/win32sck.c +++ b/win32/win32sck.c @@ -632,80 +632,6 @@ win32_socket(int af, int type, int protocol) return s; } -/* - * close RTL fd while respecting sockets - * added as temporary measure until PerlIO has real - * Win32 native layer - * -- BKS, 11-11-2000 -*/ - -int my_close(int fd) -{ - int osf; - osf = TO_SOCKET(fd);/* Get it now before it's gone! */ - if (osf != -1) { - int err; - err = closesocket(osf); - if (err == 0) { -#ifdef _set_osfhnd - assert(_osfhnd(fd) == osf); /* catch a bad ioinfo struct def */ - /* don't close freed handle */ - _set_osfhnd(fd, INVALID_HANDLE_VALUE); - return close(fd); -#else - (void)close(fd); /* handle already closed, ignore error */ - return 0; -#endif - } - else if (err == SOCKET_ERROR) { - int wsaerr = WSAGetLastError(); - err = convert_wsa_error_to_errno(wsaerr); - if (err != ENOTSOCK) { - (void)close(fd); - errno = err; - SetLastError(wsaerr); - return EOF; - } - } - } - return close(fd); -} - -#undef fclose -int -my_fclose (FILE *pf) -{ - int osf; - osf = TO_SOCKET(win32_fileno(pf));/* Get it now before it's gone! */ - if (osf != -1) { - int err; - win32_fflush(pf); - err = closesocket(osf); - if (err == 0) { -#ifdef _set_osfhnd - assert(_osfhnd(win32_fileno(pf)) == osf); /* catch a bad ioinfo struct def */ - /* don't close freed handle */ - _set_osfhnd(win32_fileno(pf), INVALID_HANDLE_VALUE); - return fclose(pf); -#else - (void)fclose(pf); /* handle already closed, ignore error */ - return 0; -#endif - } - else if (err == SOCKET_ERROR) { - int wsaerr = WSAGetLastError(); - err = convert_wsa_error_to_errno(wsaerr); - if (err != ENOTSOCK) { - (void)fclose(pf); - errno = err; - SetLastError(wsaerr); - return EOF; - } - } - } - return fclose(pf); -} - struct hostent * win32_gethostbyaddr(const char *addr, int len, int type) { |