mirror of git://sourceware.org/git/glibc.git
Update.
2000-04-10 Thorsten Kukuk <kukuk@suse.de> * elf/cache.c (save_cache): Make sure /etc/ld.so.cache is mode 644.
This commit is contained in:
parent
3b6906390e
commit
25ee87d6f1
|
@ -1,3 +1,7 @@
|
||||||
|
2000-04-10 Thorsten Kukuk <kukuk@suse.de>
|
||||||
|
|
||||||
|
* elf/cache.c (save_cache): Make sure /etc/ld.so.cache is mode 644.
|
||||||
|
|
||||||
2000-04-10 Andreas Schwab <schwab@suse.de>
|
2000-04-10 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
* posix/globtest.sh: Skip tests that depend on unreadable
|
* posix/globtest.sh: Skip tests that depend on unreadable
|
||||||
|
|
23
elf/cache.c
23
elf/cache.c
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1999 Free Software Foundation, Inc.
|
/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Andreas Jaeger <aj@suse.de>, 1999.
|
Contributed by Andreas Jaeger <aj@suse.de>, 1999.
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ print_cache (const char *cache_name)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct cache_file *cache;
|
struct cache_file *cache;
|
||||||
const char *cache_data;
|
const char *cache_data;
|
||||||
|
|
||||||
fd = open (cache_name, O_RDONLY);
|
fd = open (cache_name, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"), cache_name);
|
error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"), cache_name);
|
||||||
|
@ -122,7 +122,7 @@ print_cache (const char *cache_name)
|
||||||
close (fd);
|
close (fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache = mmap (0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
|
cache = mmap (0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
|
||||||
if (cache == MAP_FAILED)
|
if (cache == MAP_FAILED)
|
||||||
error (EXIT_FAILURE, errno, _("mmap of cache file failed.\n"));
|
error (EXIT_FAILURE, errno, _("mmap of cache file failed.\n"));
|
||||||
|
@ -135,7 +135,7 @@ print_cache (const char *cache_name)
|
||||||
cache_data = (const char *) &cache->libs[cache->nlibs];
|
cache_data = (const char *) &cache->libs[cache->nlibs];
|
||||||
|
|
||||||
printf (_("%d libs found in cache `%s'\n"), cache->nlibs, cache_name);
|
printf (_("%d libs found in cache `%s'\n"), cache->nlibs, cache_name);
|
||||||
|
|
||||||
/* Print everything. */
|
/* Print everything. */
|
||||||
for (i = 0; i < cache->nlibs; i++)
|
for (i = 0; i < cache->nlibs; i++)
|
||||||
print_entry (cache_data + cache->libs[i].key,
|
print_entry (cache_data + cache->libs[i].key,
|
||||||
|
@ -199,7 +199,7 @@ static
|
||||||
int compare (const struct cache_entry *e1, const struct cache_entry *e2)
|
int compare (const struct cache_entry *e1, const struct cache_entry *e2)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
/* We need to swap entries here to get the correct sort order. */
|
/* We need to swap entries here to get the correct sort order. */
|
||||||
res = cache_libcmp (e2->lib, e1->lib);
|
res = cache_libcmp (e2->lib, e1->lib);
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
|
@ -237,7 +237,7 @@ save_cache (const char *cache_name)
|
||||||
total_strlen += strlen (entry->lib) + strlen (entry->path) + 2;
|
total_strlen += strlen (entry->lib) + strlen (entry->path) + 2;
|
||||||
++cache_entry_count;
|
++cache_entry_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the on disk cache structure. */
|
/* Create the on disk cache structure. */
|
||||||
/* First an array for all strings. */
|
/* First an array for all strings. */
|
||||||
strings = (char *)xmalloc (total_strlen + 1);
|
strings = (char *)xmalloc (total_strlen + 1);
|
||||||
|
@ -250,7 +250,7 @@ save_cache (const char *cache_name)
|
||||||
/* Fill in the header. */
|
/* Fill in the header. */
|
||||||
memset (file_entries, 0, sizeof (struct cache_file));
|
memset (file_entries, 0, sizeof (struct cache_file));
|
||||||
memcpy (file_entries->magic, CACHEMAGIC, sizeof CACHEMAGIC - 1);
|
memcpy (file_entries->magic, CACHEMAGIC, sizeof CACHEMAGIC - 1);
|
||||||
|
|
||||||
file_entries->nlibs = cache_entry_count;
|
file_entries->nlibs = cache_entry_count;
|
||||||
|
|
||||||
str_offset = 0;
|
str_offset = 0;
|
||||||
|
@ -301,11 +301,16 @@ save_cache (const char *cache_name)
|
||||||
|
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
|
/* Make sure user can always read cache file */
|
||||||
|
if (chmod (temp_name, 0644))
|
||||||
|
error (EXIT_FAILURE, errno,
|
||||||
|
_("Changing access rights of %s to 0644 failed"), temp_name);
|
||||||
|
|
||||||
/* Move temporary to its final location. */
|
/* Move temporary to its final location. */
|
||||||
if (rename (temp_name, cache_name))
|
if (rename (temp_name, cache_name))
|
||||||
error (EXIT_FAILURE, errno, _("Renaming of %s to %s failed"), temp_name,
|
error (EXIT_FAILURE, errno, _("Renaming of %s to %s failed"), temp_name,
|
||||||
cache_name);
|
cache_name);
|
||||||
|
|
||||||
/* Free all allocated memory. */
|
/* Free all allocated memory. */
|
||||||
free (file_entries);
|
free (file_entries);
|
||||||
free (strings);
|
free (strings);
|
||||||
|
@ -334,7 +339,7 @@ add_to_cache (const char *path, const char *lib, int flags)
|
||||||
|
|
||||||
full_path = (char *) xmalloc (len);
|
full_path = (char *) xmalloc (len);
|
||||||
snprintf (full_path, len, "%s/%s", path, lib);
|
snprintf (full_path, len, "%s/%s", path, lib);
|
||||||
|
|
||||||
new_entry->lib = xstrdup (lib);
|
new_entry->lib = xstrdup (lib);
|
||||||
new_entry->path = full_path;
|
new_entry->path = full_path;
|
||||||
new_entry->flags = flags;
|
new_entry->flags = flags;
|
||||||
|
|
Loading…
Reference in New Issue