Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-Id: <4.3.1.2.20010329200632.0216a1e8@pop.ma.ultranet.com> X-Sender: lhall AT pop DOT ma DOT ultranet DOT com X-Mailer: QUALCOMM Windows Eudora Version 4.3.1 Date: Thu, 29 Mar 2001 20:07:17 -0500 To: Andre Bleau , cygwin AT sources DOT redhat DOT com From: "Larry Hall (RFK Partners, Inc)" Subject: Re: opendir crashes with -mno-cygwin In-Reply-To: <4.3.2.7.0.20010329104352.00b11730@irispavp.igb.umontreal.c a> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" At 10:53 AM 3/29/2001, Andre Bleau wrote: >The following very simple program segfaults in opendir when compiled with -mno-cygwin but runs OK when not compiled with -mno-cygwin. I tried with both gcc 2.95.3-1 and gcc 2.95.3-2. > >/* File test_dir.c **********************************************************/ > >#include >#include >#include > >int main (int argc, char *argv[]) > >{ > >DIR *dir; >struct dirent *dp; > >if (argc<2) { > printf("test_dir directory\n"); > return 1; >} > >dir = opendir(argv[1]); >if (dir==NULL) { > printf("Error opening directory %s\n", argv[1]); > return 2; >} > >for (dp=readdir(dir); dp!=NULL; dp=readdir(dir)) { > printf("\t%s\n", dp->d_name); >} > >return 0; > >} > >/****************************************************************************/ > >When compiled with -mno-cygwin, if the directory given as an argument to the program does not exist, opendir returns NULL as it should. If the directory does exist, for example ".", opendir segfaults. Where are you getting the implementation of opendir() for -mno-cygwin? Larry Hall lhall AT rfk DOT com RFK Partners, Inc. http://www.rfk.com 118 Washington Street (508) 893-9779 - RFK Office Holliston, MA 01746 (508) 893-9889 - FAX -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple