public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* opendir crashes with -mno-cygwin
@ 2001-03-29 11:59 Andre Bleau
  2001-03-29 18:13 ` Larry Hall (RFK Partners, Inc)
  0 siblings, 1 reply; 4+ messages in thread
From: Andre Bleau @ 2001-03-29 11:59 UTC (permalink / raw)
  To: cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: opendir crashes with -mno-cygwin
  2001-03-29 11:59 opendir crashes with -mno-cygwin Andre Bleau
@ 2001-03-29 18:13 ` Larry Hall (RFK Partners, Inc)
  2001-03-30  6:46   ` Earnie Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2001-03-29 18:13 UTC (permalink / raw)
  To: Andre Bleau, cygwin

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 <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.


Where are you getting the implementation of opendir() for -mno-cygwin?



Larry Hall                              lhall@rfk.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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: opendir crashes with -mno-cygwin
  2001-03-29 18:13 ` Larry Hall (RFK Partners, Inc)
@ 2001-03-30  6:46   ` Earnie Boyd
  2001-03-30  9:19     ` Andre Bleau
  0 siblings, 1 reply; 4+ messages in thread
From: Earnie Boyd @ 2001-03-30  6:46 UTC (permalink / raw)
  To: Larry Hall (RFK Partners, Inc); +Cc: Andre Bleau, cygwin

"Larry Hall (RFK Partners, Inc)" wrote:
> 
> 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.
> >
-8<-
> >
> >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.
> 

Works for me.  gcc-2.95.2-9.  NT 4 sp4

> Where are you getting the implementation of opendir() for -mno-cygwin?
> 

It's a MinGW default library function.

Earnie.

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: opendir crashes with -mno-cygwin
  2001-03-30  6:46   ` Earnie Boyd
@ 2001-03-30  9:19     ` Andre Bleau
  0 siblings, 0 replies; 4+ messages in thread
From: Andre Bleau @ 2001-03-30  9:19 UTC (permalink / raw)
  To: cygwin

Here is more info about the problem.

The program is built with:

gcc -g -mno-cygwin test_dir.c -o test_dir

cygcheck -v ./test_dir.exe gives:

Found: .\test_dir.exe
.\test_dir.exe- os=4.0 img=1.0 sys=4.0
   C:\WINNT\System32\KERNEL32.dll - os=5.0 img=5.0 sys=4.0
     "KERNEL32.dll" v0.0 ts=2000/5/3 19:43
     C:\WINNT\System32\NTDLL.DLL - os=5.0 img=5.0 sys=4.0
       "ntdll.dll" v0.0 ts=2000/5/23 20:17
   C:\WINNT\System32\msvcrt.dll - os=4.0 img=0.0 sys=4.0
     "MSVCRT.dll" v0.0 ts=1999/9/29 21:45
     C:\WINNT\System32\KERNEL32.dll (already done)

Use -h to see help about each section

I tried gcc 2.95.3-1 and 2.95.3-2 with both NT 4.0 SP6A and Windows 2000 SP1.

I attached a copy of the faulty executable. It has been renamed 
test_dir.bug to avoid triggering email virus filters.

At 09:46 2001-03-30 -0500, Earnie wrote:
>"Larry Hall (RFK Partners, Inc)" wrote:
> >
> > 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.
> > >
>-8<-
> > >
> > >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.
> >
>
>Works for me.  gcc-2.95.2-9.  NT 4 sp4
>
> > Where are you getting the implementation of opendir() for -mno-cygwin?
> >
>
>It's a MinGW default library function.
>
>Earnie.

Right, it is from the latest mingw package for Cygwin. The include file is 
/usr/include/mingw/dirent.h and the lib is /usr/lib/mingw/libmingw32.a .

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-03-30  9:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-29 11:59 opendir crashes with -mno-cygwin Andre Bleau
2001-03-29 18:13 ` Larry Hall (RFK Partners, Inc)
2001-03-30  6:46   ` Earnie Boyd
2001-03-30  9:19     ` Andre Bleau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).