This is the mail archive of the libc-alpha@cygnus.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]

libc-19980601: spurious use of __errno_location


Hi!

In several places in glibc, __errno_location is used directly.
Unfortunately, this doesn't work on the Hurd, which defines
__hurd_errno_location.

The common situation is that people want a pointer to errno, so they
use:

  __errno_location ()

However, it seems to me that:

  &errno

which expands to:

  &(*__errno_location ()) == __errno_location ()  /* Linux */
  /* &(*__hurd_errno_location ()) on the Hurd */

is just as good, and is also portable to the Hurd.

The attached patch changes all instances of `__errno_location ()' to
`&errno'.

1998-06-01  Gordon Matzigkeit  <gord@profitpress.com>

	* grp/fgetgrent_r.c: Use &errno instead of __errno_location ().
	* inet/getnetgrent_r.c: Likewise.
	* nss/getXXbyYY_r.c: Likewise.
	* nss/getXXent_r.c: Likewise.
	* pwd/fgetpwent_r.c: Likewise.
	* shadow/sgetspent_r.c: Likewise.
	* shadow/fgetspent_r.c: Likewise.
	* sunrpc/publickey.c: Likewise.

Thanks,

-- 
Gordon Matzigkeit   \ Proudly running pieces of the GNU operating system.
gord@profitpress.com \ Jacques Cousteau loved programming in assembler.

libc-19980601-errno.diff


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