Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 2003d1abfa0c20ee77815f0da33e2c1c > files > 149

glibc-2.5-49.el5_5.5.src.rpm

2006-12-19  Jakub Jelinek  <jakub@redhat.com>

	* nss/getXXbyYY_r.c: Include atomic.h.
	(INTERNAL (REENTRANT_NAME)): Write startp after start_fct,
	add atomic_write_barrier () in between.

--- libc/nss/getXXbyYY_r.c	16 Sep 2004 22:24:09 -0000	1.61
+++ libc/nss/getXXbyYY_r.c	19 Dec 2006 15:45:08 -0000	1.62
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <assert.h>
+#include <atomic.h>
 #include <errno.h>
 #include <stdbool.h>
 #include "nsswitch.h"
@@ -173,9 +174,6 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, L
 	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, L
 	  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