From 44901495168744c4344395893a0c44fdadcf3a7b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 19 Dec 2006 15:45:39 +0000 Subject: [PATCH] * nss/getXXbyYY_r.c: Include atomic.h. (INTERNAL (REENTRANT_NAME)): Write startp after start_fct, add atomic_write_barrier () in between. --- ChangeLog | 4 ++++ nss/getXXbyYY_r.c | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf4cf428b9..1f7597e719 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-12-19 Jakub Jelinek + * nss/getXXbyYY_r.c: Include atomic.h. + (INTERNAL (REENTRANT_NAME)): Write startp after start_fct, + add atomic_write_barrier () in between. + * stdlib/Makefile (tests): Add tst-makecontext. * stdlib/tst-makecontext.c: New test. diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c index 34c305f3b2..080163aac9 100644 --- a/nss/getXXbyYY_r.c +++ b/nss/getXXbyYY_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1996-2002, 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include +#include #include #include #include "nsswitch.h" @@ -173,9 +174,6 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer, startp = (service_user *) -1l; else { - startp = nip; - start_fct = fct.l; - #ifdef NEED__RES /* The resolver code will really be used so we have to initialize it. */ @@ -190,6 +188,11 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer, if (!_res_hconf.initialized) _res_hconf_init (); #endif /* need _res_hconf */ + + start_fct = fct.l; + /* Make sure start_fct is written before startp. */ + atomic_write_barrier (); + startp = nip; } } else