This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: freopen causing environ to be set to NULL


On Wed, Jun 06, 2001 at 10:46:45AM -0400, Ron Horrell wrote:
> Hi All,
> 	I am running an application on RedHat 7.1 that was built on RedHat 5.1.
> The program SIGSEGV due to the fact that environ is equal to NULL.  This is
> caused by a call to freopen redirecting stderr to a file.  This same app
> works fine on RH 6.0, 6.2 and 7.0 as well as Solaris, HPUX, AIX, SINIX,
> IRIX, SCO, SUNOS, NCR, True64 and Mac OSX.  As a work around I wrote a
> wrapper for freopen that saves the address of environ prior to calling
> freopen and if environ is equal to NULL after the call I reset it back to
> it's original value.
> 
> Build machine details:
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/specs
> gcc version 2.7.2.3
> 
> Runtime machine details:
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
> gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
> 
> Has anyone else seen this problem?
> Is this a bug with the kernel, linker or the compiler?
> Does the freopen call manipulate environ?
> 

It sounds like a glibc issue. Please provide a complete testcase.

Thanks.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]