Commit fc82e78
committed
Extract
This extracts the logic that calls `fstat`, transforms the mode
with `let_readers_execute`, and writes it back through the same
file descriptor with `fchmod`, introducing a new helper function,
`set_executable`, for it.
The reason to do this is that it makes the issue of what kind of
`Error` appears in the returned `Result` clearer. This may be
slightly clearer to humans. It's significnatly clearer to the Rust
compiler, allowing both `map_err(std::io::Error::from)` calls to
be eliminated without having to write anything confusing or
inelegant.
(This is separate from the reason the `let_readers_execute`
function, which does not access the filesystem, is its own
function. That is so it's easy to test the mode transformation
logic.)fstat and fchmod logic to a helper1 parent de939de commit fc82e78
1 file changed
+12
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
289 | | - | |
290 | | - | |
| 288 | + | |
291 | 289 | | |
292 | 290 | | |
293 | 291 | | |
| |||
296 | 294 | | |
297 | 295 | | |
298 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
299 | 308 | | |
300 | 309 | | |
301 | 310 | | |
| |||
0 commit comments