(source_path: str)
| 103 | |
| 104 | |
| 105 | def _open_source(source_path: str) -> int: |
| 106 | try: |
| 107 | return os.open(source_path, os.O_RDONLY) |
| 108 | except PermissionError as error: |
| 109 | raise BlockExtractionError( |
| 110 | f"Cannot open source {source_path}: {error}", |
| 111 | f"Permission denied: cannot open {source_path} (run as root).", |
| 112 | ) from error |
| 113 | except OSError as error: |
| 114 | raise BlockExtractionError( |
| 115 | f"Cannot open source {source_path}: {error}", |
| 116 | _get_open_error_message(source_path, error), |
| 117 | ) from error |
| 118 | |
| 119 | |
| 120 | def _safe_pread(source_fd: int, size: int, offset: int, source_path: str) -> bytes: |
no test coverage detected