def truncate(self, path, length, fh=None):
with self._lock:
if length < 0: # pragma: no cover
raise FuseOSError(EINVAL)
if fh is None:
file = self.get_file(path, expect_type=SingleFile)
else: # pragma: no cover
file = self._open_files[fh]
if self.fixed and not isinstance(file, (TempFile, SpecialFile)):
raise FuseOSError(EPERM)
file.truncate(length)
评论列表
文章目录