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

Re: There is a mistake in the manual of GNU libc.


Hi,

  On adding a new environment variable, the memory block
bound to __environ is changed by realloc(). Hence calling
getenv() simultaneously with setenv() may access freed
memory block and cause SIGSEGV.
  We should correct the manual, if using functions, such
as setenv(), unsetenv(), putenv(), and clearenv(), by
multi-threaded programs are not allowed.

Eample:
diff -ruN glibc-2.6.1.orig/manual/startup.texi
glibc-2.6.1/manual/startup.texi
--- glibc-2.6.1.orig/manual/startup.texi 2006-11-11 06:10:22.000000000 +0900
+++ glibc-2.6.1/manual/startup.texi 2007-08-30 10:37:23.000000000 +0900
@@ -309,9 +309,8 @@

 The value of an environment variable can be accessed with the
 @code{getenv} function.  This is declared in the header file
-@file{stdlib.h}.  All of the following functions can be safely used in
-multi-threaded programs.  It is made sure that concurrent modifications
-to the environment do not lead to errors.
+@file{stdlib.h}.  All the following functions other than getenv()
+can not be safely used in multi-threaded programs.
 @pindex stdlib.h

 @comment stdlib.h


Regards.



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