This is the mail archive of the glibc-cvs@sourceware.org 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]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.11-39-gc5a8b99


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  c5a8b997e2de005697a992d8db5c54995bd361a8 (commit)
      from  eb4157390cac6212921ef198353635e138dc0a00 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c5a8b997e2de005697a992d8db5c54995bd361a8

commit c5a8b997e2de005697a992d8db5c54995bd361a8
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Sun Nov 22 11:43:57 2009 -0800

    Reinitialize _create_xid state after fork.
    
    Programs forking and using RPC in the forks would use the same XIDs.

diff --git a/ChangeLog b/ChangeLog
index 4d3bd80..9a73351 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2009-11-22  Ulrich Drepper  <drepper@redhat.com>
 
+	* sunrpc/create_xid.c (_create_xid): Reinitialize state after fork.
+
 	* sysdeps/unix/sysv/linux/ntp_gettimex.c:  New file.
 	* sysdeps/unix/sysv/linux/Makefile: Add rules to build ntp_gettimex.
 	* sysdeps/unix/sysv/linux/Versions: Export ntp_gettimex for GLIBC_2.12.
diff --git a/sunrpc/create_xid.c b/sunrpc/create_xid.c
index 4e76918..c247568 100644
--- a/sunrpc/create_xid.c
+++ b/sunrpc/create_xid.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 2000, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
 
@@ -27,7 +27,7 @@
 
 __libc_lock_define_initialized (static, createxid_lock)
 
-static int is_initialized;
+static pid_t is_initialized;
 static struct drand48_data __rpc_lrand48_data;
 
 unsigned long
@@ -37,13 +37,15 @@ _create_xid (void)
 
   __libc_lock_lock (createxid_lock);
 
-  if (!is_initialized)
+  pid_t pid = getpid ();
+  if (is_initialized != pid)
     {
       struct timeval now;
 
       __gettimeofday (&now, (struct timezone *) 0);
-      __srand48_r (now.tv_sec ^ now.tv_usec, &__rpc_lrand48_data);
-      is_initialized = 1;
+      __srand48_r (now.tv_sec ^ now.tv_usec ^ pid,
+		   &__rpc_lrand48_data);
+      is_initialized = pid;
     }
 
   lrand48_r (&__rpc_lrand48_data, &res);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    2 ++
 sunrpc/create_xid.c |   12 +++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


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