]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorAndreas Jaeger <aj@suse.de>
Sun, 24 Sep 2000 18:35:20 +0000 (18:35 +0000)
committerAndreas Jaeger <aj@suse.de>
Sun, 24 Sep 2000 18:35:20 +0000 (18:35 +0000)
* elf/ldconfig.c (add_dir): Move logic to add entry to list to new
function add_single_dir.
(add_single_dir): New function.
(search_dir): Use add_single_dir instead of recursing.

ChangeLog
elf/ldconfig.c
sysdeps/generic/dl-cache.h

index 3c7d5b5afea33cbaf2b2e95a462c9ad58022840c..2cd773e25fd30deeb6a36528fdd1bbbc94136942 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2000-09-24  Andreas Jaeger  <aj@suse.de>
 
+       * elf/ldconfig.c (add_dir): Move logic to add entry to list to new
+       function add_single_dir.
+       (add_single_dir): New function. 
+       (search_dir): Use add_single_dir instead of recursing.
+
        * sysdeps/generic/dl-cache.h: Include stdint.h.
        (struct file_entry_new): Use fixed sizes for interoperability
        between 32bit and 64bit systems, add __unused to make alignment
index 50b6a261f917372b24fbe9fbdaee2d59be03f9f3..2730ad579eb8130986097184b6d13c568d7b8840 100644 (file)
@@ -258,12 +258,42 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
           "Andreas Jaeger");
 }
 
+/* Add a single directory entry.  */
+static void
+add_single_dir (struct dir_entry *entry, int verbose)
+{
+  struct dir_entry *ptr, *prev;
+
+  ptr = dir_entries;
+  prev = ptr;
+  while (ptr != NULL)
+    {
+      /* Check for duplicates.  */
+      if (strcmp (ptr->path, entry->path) == 0)
+       {
+         if (opt_verbose && verbose)
+           error (0, 0, _("Path `%s' given more than once"), entry->path);
+         /* Use the newer information.  */
+         ptr->flag = entry->flag;
+         free (entry);
+         break;
+       }
+      prev = ptr;
+      ptr = ptr->next;
+    }
+  /* Is this the first entry?  */
+  if (ptr == NULL && dir_entries == NULL)
+    dir_entries = entry;
+  else if (ptr == NULL)
+    prev->next = entry;
+}
+
 /* Add one directory to the list of directories to process.  */
 static void
 add_dir (const char *line)
 {
   char *equal_sign;
-  struct dir_entry *entry, *ptr, *prev;
+  struct dir_entry *entry;
   unsigned int i;
 
   entry = xmalloc (sizeof (struct dir_entry));
@@ -299,28 +329,7 @@ add_dir (const char *line)
       --i;
     }
 
-  ptr = dir_entries;
-  prev = ptr;
-  while (ptr != NULL)
-    {
-      /* Check for duplicates.  */
-      if (strcmp (ptr->path, entry->path) == 0)
-       {
-         if (opt_verbose)
-           error (0, 0, _("Path `%s' given more than once"), entry->path);
-         /* Use the newer information.  */
-         ptr->flag = entry->flag;
-         free (entry);
-         break;
-       }
-      prev = ptr;
-      ptr = ptr->next;
-    }
-  /* Is this the first entry?  */
-  if (ptr == NULL && dir_entries == NULL)
-    dir_entries = entry;
-  else if (ptr == NULL)
-    prev->next = entry;
+  add_single_dir (entry, 1);
 }
 
 
@@ -571,12 +580,15 @@ search_dir (const struct dir_entry *entry)
 
       if (S_ISDIR (stat_buf.st_mode) && is_hwcap (direntry->d_name))
        {
-         /* Handle subdirectory also, make a recursive call.  */
-         struct dir_entry new_entry;
-         new_entry.path = buf;
-         new_entry.flag = entry->flag;
-         new_entry.next = NULL;
-         search_dir (&new_entry);
+         /* Handle subdirectory later.  */
+         struct dir_entry *new_entry;
+
+         new_entry = xmalloc (sizeof (struct dir_entry));
+
+         new_entry->path = buf;
+         new_entry->flag = entry->flag;
+         new_entry->next = NULL;
+         add_single_dir (new_entry, 0);
          continue;
        }
       else if (!S_ISREG (stat_buf.st_mode) && !S_ISLNK (stat_buf.st_mode))
index fdf38785e1fef5f984c2314cdb44f7ce8c354b18..894b28ee7ba057af8ae7b8e692dccf5633a47411 100644 (file)
@@ -17,6 +17,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <stdint.h>
+
 #ifndef _DL_CACHE_DEFAULT_ID
 # define _DL_CACHE_DEFAULT_ID  3
 #endif
@@ -66,25 +68,27 @@ struct cache_file
 };
 
 #define CACHEMAGIC_NEW "glibc-ld.so.cache"
-#define CACHE_VERSION "1.0"
+#define CACHE_VERSION "1.1"
 
 
 struct file_entry_new
 {
-  int flags;                   /* This is 1 for an ELF library.  */
-  unsigned int key, value;     /* String table indices.  */
-  unsigned long hwcap;         /* Hwcap entry.  */
+  int32_t flags;               /* This is 1 for an ELF library.  */
+  uint32_t key, value;         /* String table indices.  */
+  uint32_t __unused;           /* Align next field always on 8 byte boundary.  */
+  uint64_t hwcap;              /* Hwcap entry.  */
 };
 
 struct cache_file_new
 {
   char magic[sizeof CACHEMAGIC_NEW - 1];
   char version[sizeof CACHE_VERSION - 1];
-  unsigned int nlibs;          /* Number of entries.  */
-  unsigned int len_strings;    /* Size of string table. */
-  unsigned int unused[4];      /* Leave space for future extensions.  */
+  uint32_t nlibs;              /* Number of entries.  */
+  uint32_t len_strings;                /* Size of string table. */
+  uint32_t unused[5];          /* Leave space for future extensions
+                                  and align to 8 byte boundary.  */
   struct file_entry_new libs[0]; /* Entries describing libraries.  */
-  /* After this the string table of size len_strings is found.  */
+  /* After this the string table of size len_strings is found. */
 };
 
 /* Used to align cache_file_new.  */