Re: [PATCH] freopen SEGFAULT on win32 with filename == NULL

2011-09-01 Thread Bruno Haible
Hello Claudio, > >> rpl_freopen (const char *filename, const char *mode, FILE *stream) > >> { > >> #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ > >> +# ifdef _MSC_VER > >> + if (!filename) return NULL; /* would trigger a runtime error on MSVC */ > >> +# endif > >>if

Re: [PATCH] freopen SEGFAULT on win32 with filename == NULL

2011-09-01 Thread Claudio Bley
Bruno Haible writes: > Claudio Bley wrote: >> >> --- freopen.c.orig 2011-08-03 14:22:15 +0200 >> +++ freopen.c2011-08-25 21:01:46 +0200 >> @@ -38,7 +38,7 @@ >> rpl_freopen (const char *filename, const char *mode, FILE *stream) >> { >> #if (defined _WIN32 || defin

Re: [PATCH] freopen SEGFAULT on win32 with filename == NULL

2011-08-31 Thread Bruno Haible
Bastien ROUCARIES wrote: > >> - hpux has pstat > > > > More details, please? pstat_getfiledetails does not return a file name. > > See pstat_getpathname() I can't find a definition of pst_fid anywhere. Also, this function only accesses a cache; it may fail. Also, what if fd is a pipe or socket?

Re: [PATCH] freopen SEGFAULT on win32 with filename == NULL

2011-08-31 Thread Bastien ROUCARIES
On Wed, Aug 31, 2011 at 9:54 PM, Bruno Haible wrote: > Bastien ROUCARIES wrote: >> More means to retrieve file name >> - linux /proc/self/fd >> - windows FileInformation  of GetFileInformationByHandleEx >> - freebsd using FDESCFS /dev/fd or proc >> - solaris using FDESCFS or proc >> - osx as /dev/

Re: [PATCH] freopen SEGFAULT on win32 with filename == NULL

2011-08-31 Thread Bruno Haible
Bastien ROUCARIES wrote: > More means to retrieve file name > - linux /proc/self/fd > - windows FileInformation of GetFileInformationByHandleEx > - freebsd using FDESCFS /dev/fd or proc > - solaris using FDESCFS or proc > - osx as /dev/fd > - irix has /dev/fd Interesting, yes. That would work. >

Re: [PATCH] freopen SEGFAULT on win32 with filename == NULL

2011-08-31 Thread Bastien ROUCARIES
On Wed, Aug 31, 2011 at 11:13 AM, Bastien ROUCARIES wrote: > On Wed, Aug 31, 2011 at 10:49 AM, Bruno Haible wrote: >> Claudio Bley wrote: >>> Furthermore, using NULL as filename does not work at all using the MS >>> C runtime library (debug assertion violation). >>> >>> >>> -

Re: [PATCH] freopen SEGFAULT on win32 with filename == NULL

2011-08-31 Thread Bastien ROUCARIES
On Wed, Aug 31, 2011 at 10:49 AM, Bruno Haible wrote: > Claudio Bley wrote: >> Furthermore, using NULL as filename does not work at all using the MS >> C runtime library (debug assertion violation). >> >> >> --- freopen.c.1       2011-08-25 21:05:34 +0200 >> +++ freopen.c 2011

Re: [PATCH] freopen SEGFAULT on win32 with filename == NULL

2011-08-31 Thread Bruno Haible
Claudio Bley wrote: > Furthermore, using NULL as filename does not work at all using the MS > C runtime library (debug assertion violation). > > > --- freopen.c.1 2011-08-25 21:05:34 +0200 > +++ freopen.c 2011-08-25 21:08:52 +0200 > @@ -38,6 +38,9 @@ > rpl_freopen (cons

Re: [PATCH] freopen SEGFAULT on win32 with filename == NULL

2011-08-31 Thread Bruno Haible
Claudio Bley wrote: > When calling > > freopen(NULL, mode, stream); > > on MS Windows using MinGW segfaults because it tries to strcmp(NULL, > "/dev/null")... *ouch* > > > --- freopen.c.orig2011-08-03 14:22:15 +0200 > +++ freopen.c 2011-08-25 21:01:46 +0200 > @@ -38,7 +

[PATCH] freopen SEGFAULT on win32 with filename == NULL

2011-08-25 Thread Claudio Bley
Hi. When calling freopen(NULL, mode, stream); on MS Windows using MinGW segfaults because it tries to strcmp(NULL, "/dev/null")... *ouch* --- freopen.c.orig 2011-08-03 14:22:15 +0200 +++ freopen.c 2011-08-25 21:01:46 +0200 @@ -38,7 +38,7 @@ rpl_freopen (const char