This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: Fwd: getenv() in glibc
- To: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
- Subject: Re: Fwd: getenv() in glibc
- From: Andreas Schwab <schwab@suse.de>
- Date: 10 Sep 1999 14:21:41 +0200
- Cc: libc-alpha@sourceware.cygnus.com, Frank Jas <frank@jrware.com>
- References: <4.2.0.58.19990910120444.00949180@mail.lauterbach.com>
Franz Sirl <Franz.Sirl-kernel@lauterbach.com> writes:
|> Hi,
|>
|> I just verified Frank's report on Linux/PPC, does this happen on other
|> platforms too?
I don't know which platforms that are, but it happens on all bigendian
platforms that don't allow unaligned memory accesses (sparc?).
1999-09-10 Andreas Schwab <schwab@suse.de>
* sysdeps/generic/getenv.c (getenv): Fix lookup for single
character variable on bigendian platforms without unaligned memory
access.
Index: sysdeps/generic/getenv.c
===================================================================
RCS file: /glibc/cvsfiles/libc/sysdeps/generic/getenv.c,v
retrieving revision 1.7
diff -u -a -u -r1.7 sysdeps/generic/getenv.c
--- sysdeps/generic/getenv.c 1998/06/12 07:35:30 1.7
+++ sysdeps/generic/getenv.c 1999/09/10 12:19:04
@@ -49,7 +49,7 @@
/* The name of the variable consists of only one character. Therefore
the first two characters of the environment entry are this character
and a '=' character. */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if __BYTE_ORDER == __LITTLE_ENDIAN || !_STRING_ARCH_unaligned
name_start = ('=' << 8) | *(const unsigned char *) name;
#else
# if __BYTE_ORDER == __BIG_ENDIAN
--
Andreas Schwab "And now for something
schwab@suse.de completely different."
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg