BUG [cygwin(cvs)]: Segfault in fhandler_base when attempting to calculate maximum open files on WinME&2000

Nicholas Wourms nwourms@netscape.net
Wed Jul 9 04:24:00 GMT 2003


Hi,

There seems to be a nasty autoconf macro in coreutils (open-max.m4*) 
which attempts to compile and execute the following the code for the 
purpose of determining the system's simultaneous open file maximum:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
     int
     main ()
     {
       FILE *result = fopen ("conftest.omax", "w");
       int i = 1;
       /* Impose an arbitrary limit, in case some system has no
	 effective limit on the number of simultaneously open files.  */
       while (i < 30000)
	{
	  FILE *s = fopen ("conftest.op", "w");
	  if (!s)
	    break;
	  ++i;
	}
       fprintf (result, "%d\n", i);
       exit (fclose (result) == EOF);
     }

Executing the code segfaults with the following messages:

    5 [main] foo 1008 cmalloc: cmalloc returned NULL
5004 [main] foo 1008 fhandler_base::set_name: fatal error. strdup failed

Examining the binary in gdb reveals that it dies at line 1198 of 
fhandler.cc.  This is 100% reproducable on a machine running WinME & 
another running Win2k SP4.  The dll being used was built from cvs 
sources checked out today.  Of course the test works fine on linux. 
Since this should be readily reproducable on any Cygwin platform running 
the most current sources & packages, I'm not going to flood the list 
with cygcheck.

Cheers,
Nicholas

* You can also get it in m4 form from here:
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/coreutils/coreutils/m4/open-max.m4?rev=HEAD&content-type=text/plain




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list