diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-11-14 04:13:50 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-11-14 04:13:50 +0000 |
commit | 00b027972d07e1d53ec42ba7bbc007b558fb67f0 (patch) | |
tree | 069345c0006e2ad68b25c7b5cfcef49ce612ebfd /win32/win32sck.c | |
parent | e601c439adce167078ac7b49550c0418ace86f94 (diff) | |
download | perl-00b027972d07e1d53ec42ba7bbc007b558fb67f0.tar.gz |
Redo #7679 with LFs instead of CRLFs.
p4raw-id: //depot/perl@7680
Diffstat (limited to 'win32/win32sck.c')
-rw-r--r-- | win32/win32sck.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/win32/win32sck.c b/win32/win32sck.c index 4a4131c1b1..041963a8c9 100644 --- a/win32/win32sck.c +++ b/win32/win32sck.c @@ -418,41 +418,41 @@ 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;
- if (!wsock_started) /* No WinSock? */
- return(close(fd)); /* Then not a socket. */
- osf = TO_SOCKET(fd);/* Get it now before it's gone! */
- if (osf != -1) {
- int err;
- err = closesocket(osf);
- if (err == 0) {
-#if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX)
- _set_osfhnd(fd, INVALID_HANDLE_VALUE);
-#endif
- (void)close(fd); /* handle already closed, ignore error */
- return 0;
- }
- else if (err == SOCKET_ERROR) {
- err = WSAGetLastError();
- if (err != WSAENOTSOCK) {
- (void)close(fd);
- errno = err;
- return EOF;
- }
- }
- }
- return close(fd);
-}
-
+/* + * 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; + if (!wsock_started) /* No WinSock? */ + return(close(fd)); /* Then not a socket. */ + osf = TO_SOCKET(fd);/* Get it now before it's gone! */ + if (osf != -1) { + int err; + err = closesocket(osf); + if (err == 0) { +#if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX) + _set_osfhnd(fd, INVALID_HANDLE_VALUE); +#endif + (void)close(fd); /* handle already closed, ignore error */ + return 0; + } + else if (err == SOCKET_ERROR) { + err = WSAGetLastError(); + if (err != WSAENOTSOCK) { + (void)close(fd); + errno = err; + return EOF; + } + } + } + return close(fd); +} + #undef fclose int my_fclose (FILE *pf) @@ -460,14 +460,14 @@ my_fclose (FILE *pf) int osf; if (!wsock_started) /* No WinSock? */ return(fclose(pf)); /* Then not a socket. */ - osf = TO_SOCKET(win32_fileno(pf));/* Get it now before it's gone! */
+ 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) { #if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX) - _set_osfhnd(win32_fileno(pf), INVALID_HANDLE_VALUE);
+ _set_osfhnd(win32_fileno(pf), INVALID_HANDLE_VALUE); #endif (void)fclose(pf); /* handle already closed, ignore error */ return 0; |