Bugsplat bug #350054: in the NT implementation of SocketTransmitFile,
authorwtc%netscape.com
Fri, 23 Apr 1999 19:45:24 +0000
changeset 580 c998b61248a140165da5067ebeaf5f02d8a7ef07
parent 564 105df5f4367d6d1226436b9ef164913ff8a644db
child 581 820017031a3775c5f7bd10155d835c2180ff7c35
child 582 871b822c9a95ba55dda084f7c1052dea99330e00
push idunknown
push userunknown
push dateunknown
bugs350054
Bugsplat bug #350054: in the NT implementation of SocketTransmitFile, free the PRFileDesc only if the file is successfully transmitted.
pr/src/io/prsocket.c
--- a/pr/src/io/prsocket.c
+++ b/pr/src/io/prsocket.c
@@ -872,20 +872,17 @@ PRIntervalTime timeout)
 	if (sd->secret->nonblocking) {
 		PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
 		return -1;
 	}
 #if defined(WINNT)
 	rv = _PR_MD_TRANSMITFILE(
 		sd, fd,
 		headers, hlen, flags, timeout);
-	if (rv < 0) {
-		rv = -1;
-	}
-	if (flags & PR_TRANSMITFILE_CLOSE_SOCKET) {
+	if ((rv >= 0) && (flags == PR_TRANSMITFILE_CLOSE_SOCKET)) {
 		/*
 		 * This should be kept the same as SocketClose, except
 		 * that _PR_MD_CLOSE_SOCKET(sd->secret->md.osfd) should
 		 * not be called because the socket will be recycled.
 		 */
 		PR_FreeFileDesc(sd);
 	}
 #else