This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libgcj/29604] Race condition in ServerSocket.accept()



------- Comment #6 from daney at gcc dot gnu dot org  2007-05-19 18:20 -------
That didn't come out quite right :(.

The close part would be:

========================
int t = dup(fileDes)
dup2(global_always_error_fd, fileDes);
synchronized {
   cleanupFD = fileDes;
}
close (t);
synchronized {
   if (fileDesInUse == 0) {
      close(cleanupFD);
      cleanupFD = -1;
   }
}
========================

Yeah, that should work.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29604


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]