This is the mail archive of the libc-hacker@sourceware.cygnus.com 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]

patch for glibc-2.0.7



Hmm... The latest environment-related patches broke glibc. Not a very
pleasant surprise, even more that the runtime loader is so f%*&ing hard to
debug... (unless I am missing some magic way to step into its code)

Attached patch "Works for us"(tm).

Cristian
--
----------------------------------------------------------------------
Cristian Gafton   --   gafton@redhat.com   --   Red Hat Software, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 UNIX is user friendly. It's just selective about who its friends are.
--- glibc-2.0.7/elf/rtld.c.gafton	Mon Jul 13 16:27:42 1998
+++ glibc-2.0.7/elf/rtld.c	Mon Jul 13 16:29:32 1998
@@ -371,7 +371,7 @@
       char *list = strdupa (preloadlist);
       char *p;
       list += strspn (list, " :");
-      while (*list && (p = strsep (&list, " :")) != NULL)
+      while (list && *list && (p = strsep (&list, " :")) != NULL)
 	if (! __libc_enable_secure || strchr (p, '/') == NULL)
 	  {
 	    struct link_map *new_map = _dl_map_object (l, p, 1, lt_library, 0);
@@ -439,7 +439,7 @@
 	{
 	  char *p;
 	  runp = file + strspn (file, ": \t\n");
-	  while (*runp && (p = strsep (&runp, ": \t\n")) != NULL)
+	  while (runp && *runp && (p = strsep (&runp, ": \t\n")) != NULL)
 	    {
 	      struct link_map *new_map = _dl_map_object (l, p, 1,
 							 lt_library, 0);
--- glibc-2.0.7/sysdeps/generic/dl-sysdep.c.gafton	Fri Jan 30 22:30:49 1998
+++ glibc-2.0.7/sysdeps/generic/dl-sysdep.c	Mon Jul 13 16:27:42 1998
@@ -226,3 +226,23 @@
     } while (msg);
   va_end (ap);
 }
+
+void
+unsetenv (const char *name)
+{
+    const size_t len = strlen (name);
+    char **ep;
+    
+    for (ep = _environ; *ep != NULL; ++ep)
+	if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+	    {
+		/* Found it.  Remove this pointer by moving later ones back.  */
+		char **dp = ep;
+
+		do
+		    dp[0] = dp[1];
+		while (*dp++);
+		/* Continue the loop in case NAME appears again.  */
+	    }
+}
+    

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