[PATCH] Remove stale symlinks in ldconfig
Jakub Jelinek
jakub@redhat.com
Thu Aug 23 11:45:00 GMT 2001
Hi!
Pre-glibc ldconfig used to remove stale symlinks with .so. substring in
their names, current one does not.
This can result in /usr/lib and other directories cluttered with stale
symlinks after some upgrades. Many packages own the symlinks to libs and
package management removes them on upgrades, but many don't, especially
those coming from non-distro sources.
The point is when ldconfig is creating those symlinks, it should be
responsible for cleaning them up too I think.
2001-08-23 Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (search_dir): Remove stale symlinks.
--- libc/elf/ldconfig.c.jj Thu Aug 23 18:47:05 2001
+++ libc/elf/ldconfig.c Thu Aug 23 20:13:11 2001
@@ -699,6 +699,10 @@ search_dir (const struct dir_entry *entr
{
if (opt_verbose)
error (0, errno, _("Cannot stat %s"), file_name);
+
+ /* Remove stale symlinks. */
+ if (strstr(direntry->d_name, ".so."))
+ unlink(real_file_name);
continue;
}
is_dir = S_ISDIR (stat_buf.st_mode);
Jakub
More information about the Libc-hacker
mailing list