]> git.tdb.fi Git - builder.git/commitdiff
Don't try to create links with the same name as the file itself
authorMikko Rasa <tdb@tdb.fi>
Thu, 13 Sep 2012 07:53:03 +0000 (10:53 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 13 Sep 2012 07:53:03 +0000 (10:53 +0300)
source/gnulinker.cpp
source/installedfile.cpp

index 114bf09c84404910f480a904aa952761366eb2fa..cd40a853cac56ffe8d06295c4bb9c96650e9c7cf 100644 (file)
@@ -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;
        }
index 35742bb0daf8e383f90418f621b438c14eb9e223..723d776415df33e77c8b1fe53287746bf1dbeeab 100644 (file)
@@ -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);
 }