This commit is contained in:
Andreas Jaeger 2001-05-08 10:40:10 +00:00
parent c5d6c25b71
commit 4ceae91566
2 changed files with 49 additions and 10 deletions

View File

@ -22,7 +22,7 @@
* scripts/config.guess: Imported from gnu.org. * scripts/config.guess: Imported from gnu.org.
* scripts/config.sub: Likewise. * scripts/config.sub: Likewise.
2001-05-05 Jakub Jelinek <jakub@redhat.com> 2001-05-05 Jakub Jelinek <jakub@redhat.com>
* include/features.h (__USE_EXTERN_INLINES): Don't define if * include/features.h (__USE_EXTERN_INLINES): Don't define if

View File

@ -66,6 +66,8 @@ struct dir_entry
{ {
char *path; char *path;
int flag; int flag;
ino64_t ino;
dev_t dev;
struct dir_entry *next; struct dir_entry *next;
}; };
@ -270,12 +272,13 @@ add_single_dir (struct dir_entry *entry, int verbose)
while (ptr != NULL) while (ptr != NULL)
{ {
/* Check for duplicates. */ /* Check for duplicates. */
if (strcmp (ptr->path, entry->path) == 0) if (ptr->ino == entry->ino && ptr->dev == entry->dev)
{ {
if (opt_verbose && verbose) if (opt_verbose && verbose)
error (0, 0, _("Path `%s' given more than once"), entry->path); error (0, 0, _("Path `%s' given more than once"), entry->path);
/* Use the newer information. */ /* Use the newer information. */
ptr->flag = entry->flag; ptr->flag = entry->flag;
free (entry->path);
free (entry); free (entry);
break; break;
} }
@ -296,6 +299,7 @@ add_dir (const char *line)
char *equal_sign; char *equal_sign;
struct dir_entry *entry; struct dir_entry *entry;
unsigned int i; unsigned int i;
struct stat64 stat_buf;
entry = xmalloc (sizeof (struct dir_entry)); entry = xmalloc (sizeof (struct dir_entry));
entry->next = NULL; entry->next = NULL;
@ -330,7 +334,18 @@ add_dir (const char *line)
--i; --i;
} }
add_single_dir (entry, 1); if (stat64 (entry->path, &stat_buf))
{
error (0, errno, _("Can't stat %s"), entry->path);
free (entry->path);
free (entry);
return;
}
entry->ino = stat_buf.st_ino;
entry->dev = stat_buf.st_dev;
add_single_dir (entry, 1);
} }
@ -577,8 +592,8 @@ search_dir (const struct dir_entry *entry)
char *soname; char *soname;
struct dlib_entry *dlibs; struct dlib_entry *dlibs;
struct dlib_entry *dlib_ptr; struct dlib_entry *dlib_ptr;
struct stat64 stat_buf; struct stat64 lstat_buf, stat_buf;
int is_link; int is_link, is_dir;
uint64_t hwcap = path_hwcap (entry->path); uint64_t hwcap = path_hwcap (entry->path);
unsigned int osversion; unsigned int osversion;
@ -657,16 +672,31 @@ search_dir (const struct dir_entry *entry)
} }
#ifdef _DIRENT_HAVE_D_TYPE #ifdef _DIRENT_HAVE_D_TYPE
if (direntry->d_type != DT_UNKNOWN) if (direntry->d_type != DT_UNKNOWN)
stat_buf.st_mode = DTTOIF (direntry->d_type); lstat_buf.st_mode = DTTOIF (direntry->d_type);
else else
#endif #endif
if (lstat64 (real_file_name, &stat_buf)) if (lstat64 (real_file_name, &lstat_buf))
{ {
error (0, errno, _("Can't lstat %s"), file_name); error (0, errno, _("Can't lstat %s"), file_name);
continue; continue;
} }
if (S_ISDIR (stat_buf.st_mode) && is_hwcap_platform (direntry->d_name)) is_link = S_ISLNK (lstat_buf.st_mode);
if (is_link)
{
/* In case of symlink, we check if the symlink refers to
a directory. */
if (stat64 (real_file_name, &stat_buf))
{
error (0, errno, _("Can't stat %s"), file_name);
continue;
}
is_dir = S_ISDIR (stat_buf.st_mode);
}
else
is_dir = S_ISDIR (lstat_buf.st_mode);
if (is_dir && is_hwcap_platform (direntry->d_name))
{ {
/* Handle subdirectory later. */ /* Handle subdirectory later. */
struct dir_entry *new_entry; struct dir_entry *new_entry;
@ -675,13 +705,22 @@ search_dir (const struct dir_entry *entry)
new_entry->path = xstrdup (file_name); new_entry->path = xstrdup (file_name);
new_entry->flag = entry->flag; new_entry->flag = entry->flag;
new_entry->next = NULL; new_entry->next = NULL;
if (is_link)
{
new_entry->ino = stat_buf.st_ino;
new_entry->dev = stat_buf.st_dev;
}
else
{
new_entry->ino = lstat_buf.st_ino;
new_entry->dev = lstat_buf.st_dev;
}
add_single_dir (new_entry, 0); add_single_dir (new_entry, 0);
continue; continue;
} }
else if (!S_ISREG (stat_buf.st_mode) && !S_ISLNK (stat_buf.st_mode)) else if (!S_ISREG (stat_buf.st_mode) && !is_link)
continue; continue;
is_link = S_ISLNK (stat_buf.st_mode);
if (opt_chroot && is_link) if (opt_chroot && is_link)
{ {
real_name = chroot_canon (opt_chroot, file_name); real_name = chroot_canon (opt_chroot, file_name);