freopen causing environ to be set to NULL
H . J . Lu
hjl@lucon.org
Wed Jun 6 07:39:00 GMT 2001
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.
More information about the Libc-alpha
mailing list