[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r14313 - in /branches/eglibc-2_13/libc: ChangeLog.eglibc resolv/res_libc.c



Author: maxim
Date: Thu Jun 23 04:07:36 2011
New Revision: 14313

Log:
	Backport from trunk:
	2011-06-23  Paul Pluzhnikov  <ppluzhnikov@xxxxxxxxxx>
	* resolv/res_libc.c (__res_initstamp): Declare unconditionally.
	(__res_maybe_init): Avoid double-checked locking.

Modified:
    branches/eglibc-2_13/libc/ChangeLog.eglibc
    branches/eglibc-2_13/libc/resolv/res_libc.c

Modified: branches/eglibc-2_13/libc/ChangeLog.eglibc
==============================================================================
--- branches/eglibc-2_13/libc/ChangeLog.eglibc (original)
+++ branches/eglibc-2_13/libc/ChangeLog.eglibc Thu Jun 23 04:07:36 2011
@@ -1,3 +1,10 @@
+2011-06-23  Maxim Kuvyrkov  <maxim@xxxxxxxxxxxxxxxx>
+
+	Backport from trunk:
+	2011-06-23  Paul Pluzhnikov  <ppluzhnikov@xxxxxxxxxx>
+	* resolv/res_libc.c (__res_initstamp): Declare unconditionally.
+	(__res_maybe_init): Avoid double-checked locking.
+
 2011-06-10  Maxim Kuvyrkov  <maxim@xxxxxxxxxxxxxxxx>
 
 	Backport from trunk:

Modified: branches/eglibc-2_13/libc/resolv/res_libc.c
==============================================================================
--- branches/eglibc-2_13/libc/resolv/res_libc.c (original)
+++ branches/eglibc-2_13/libc/resolv/res_libc.c Thu Jun 23 04:07:36 2011
@@ -28,6 +28,7 @@
    out) since res_init() should go into libc.so but the rest of that
    file should not.  */
 
+__libc_lock_define_initialized (static, lock);
 extern unsigned long long int __res_initstamp attribute_hidden;
 /* We have atomic increment operations on 64-bit platforms.  */
 #if __WORDSIZE == 64
@@ -35,7 +36,6 @@
 # define atomicincunlock(lock) (void) 0
 # define atomicinc(var) catomic_increment (&(var))
 #else
-__libc_lock_define_initialized (static, lock);
 # define atomicinclock(lock) __libc_lock_lock (lock)
 # define atomicincunlock(lock) __libc_lock_unlock (lock)
 # define atomicinc(var) ++var
@@ -100,12 +100,12 @@
 
 	if (resp->options & RES_INIT) {
 		ret = stat (_PATH_RESCONF, &statbuf);
+		__libc_lock_lock (lock);
 		if ((ret == 0) && (last_mtime != statbuf.st_mtime)) {
 			last_mtime = statbuf.st_mtime;
-			atomicinclock (lock);
 			atomicinc (__res_initstamp);
-			atomicincunlock (lock);
 		}
+		__libc_lock_unlock (lock);
 		if (__res_initstamp != resp->_u._ext.initstamp) {
 			if (resp->nscount > 0)
 				__res_iclose (resp, true);