From 98ad5711a0c56d9783a0d22b932e9b55ddd30ba2 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 13 Sep 2012 10:53:03 +0300 Subject: [PATCH] Don't try to create links with the same name as the file itself --- source/gnulinker.cpp | 4 +++- source/installedfile.cpp | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/gnulinker.cpp b/source/gnulinker.cpp index 114bf09..cd40a85 100644 --- a/source/gnulinker.cpp +++ b/source/gnulinker.cpp @@ -99,7 +99,9 @@ Target *GnuLinker::create_install(Target &target) const else { const Pattern &pattern = architecture->get_shared_library_patterns().front(); - inst_tgt->set_symlink(pattern.apply(shlib->get_libname())); + string link_name = pattern.apply(shlib->get_libname()); + if(link_name!=FS::basename(inst_tgt->get_path())) + inst_tgt->set_symlink(link_name); } return inst_tgt; } diff --git a/source/installedfile.cpp b/source/installedfile.cpp index 35742bb..723d776 100644 --- a/source/installedfile.cpp +++ b/source/installedfile.cpp @@ -36,6 +36,9 @@ FS::Path InstalledFile::generate_target_path(const FS::Path &prefix, const FileT void InstalledFile::set_symlink(const FS::Path &l) { + FS::Path al = FS::dirname(path)/l; + if(al==path) + throw invalid_argument("InstalledFile::set_symlink"); link = FS::dirname(path)/l; builder.get_vfs().register_path(link, this); } -- 2.45.2