harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r601660 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
Date Thu, 06 Dec 2007 08:51:19 GMT
Author: hindessm
Date: Thu Dec  6 00:51:18 2007
New Revision: 601660

URL: http://svn.apache.org/viewvc?rev=601660&view=rev
Log:
Fixed for one error condition covered by "[#HARMONY-5219]
[classlib][nio] Jetty@Harmony corrupts big static files while
downloading".  We shoud try to avoid this by checking this condition
in Java code but it could still occur if another thread closes the
socket after the file descriptor array has been populated.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c?rev=601660&r1=601659&r2=601660&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
Thu Dec  6 00:51:18 2007
@@ -267,7 +267,8 @@
 	  hysocketP = getJavaIoFileDescriptorContentsAsAPointer	(env, gotFD);
       (*env)->DeleteLocalRef(env, gotFD);
 
-      my_pollfds[val].fd = hysocketP->sock;
+      /* hysocketP is -1 if the socket is closed */
+      my_pollfds[val].fd = hysocketP == -1 ? -1 : hysocketP->sock;
       my_pollfds[val].events = POLLIN | POLLPRI;
       my_pollfds[val].revents = 0;
   }
@@ -277,7 +278,8 @@
 	  hysocketP = getJavaIoFileDescriptorContentsAsAPointer	(env, gotFD);
       (*env)->DeleteLocalRef(env, gotFD);
 
-      my_pollfds[countReadC + val].fd = hysocketP->sock;
+      /* hysocketP is -1 if the socket is closed */
+      my_pollfds[countReadC + val].fd = hysocketP == -1 ? -1 : hysocketP->sock;
       my_pollfds[countReadC + val].events = POLLOUT;
       my_pollfds[countReadC + val].revents = 0;
   }



Mime
View raw message