fs_abilities.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:rdiff-backup 作者: sol1 项目源码 文件源码
def set_hardlinks(self, testdir):
        """Set self.hardlinks to true iff hard linked files can be made"""
        hl_source = testdir.append("hardlinked_file1")
        hl_dir = testdir.append("hl")
        hl_dir.mkdir()
        hl_dest = hl_dir.append("hardlinked_file2")
        hl_source.touch()
        try:
            hl_dest.hardlink(hl_source.path)
            if hl_source.getinode() != hl_dest.getinode():
                raise IOError(errno.EOPNOTSUPP, "Hard links don't compare")
        except (IOError, OSError, AttributeError):
            if Globals.preserve_hardlinks != 0:
                log.Log("Warning: hard linking not supported by filesystem "
                        "at %s" % (self.root_rp.path,), 3)
            self.hardlinks = None
        else: self.hardlinks = 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号