rpath.py 文件源码

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

项目:rdiff-backup 作者: sol1 项目源码 文件源码
def makedev(self, type, major, minor):
        """Make a special file with specified type, and major/minor nums"""
        if type == 'c':
            datatype = 'chr'
            mode = stat.S_IFCHR | 0600
        elif type == 'b':
            datatype = 'blk'
            mode = stat.S_IFBLK | 0600
        else: raise RPathException
        try: self.conn.os.mknod(self.path, mode, self.conn.os.makedev(major, minor))
        except (OSError, AttributeError), e:
            if isinstance(e, AttributeError) or e.errno == errno.EPERM:
                # AttributeError will be raised by Python 2.2, which
                # doesn't have os.mknod
                log.Log("unable to mknod %s -- using touch instead" % self.path, 4)
                self.touch()
        self.setdata()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号