This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
opendir crashes with -mno-cygwin
- To: cygwin at sources dot redhat dot com
- Subject: opendir crashes with -mno-cygwin
- From: Andre Bleau <bleau at igb dot umontreal dot ca>
- Date: Thu, 29 Mar 2001 10:53:54 -0500
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 <stdlib.h>
#include <stdio.h>
#include <dirent.h>
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.
André Bleau, Cygwin's OpenGL package maintainer.
email: bleau at igb dot umontreal dot ca
(Fight SPAM: encode your email-address)
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple