diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 23:20:19 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 23:22:39 -0300 |
| commit | dd6a3c2c367cee12a8e2da81e7da6a2c8f3103d5 (patch) | |
| tree | 3c2acaf6836af9c52b7cfbf201a2c1b533512d10 /src/fs.zig | |
| parent | e4562384ac910b78254ec7aaaecad8b74717f2ee (diff) | |
| download | pardes-dd6a3c2c367cee12a8e2da81e7da6a2c8f3103d5.tar.gz pardes-dd6a3c2c367cee12a8e2da81e7da6a2c8f3103d5.zip | |
Round 39's small ones: a name write past its one line is refused by that write; Get and Edit's e load over a scratch under 100 bytes unasked, as Del closes it; Putall saves a Zerox pair once; bare Tab on the root ctl says the width as from a pane, and a ctl check of Tab no longer sets it; a directory read is "is a directory" (EISDIR), an unreadable file "permission denied" (EACCES), Incl of a file "not a directory" (ENOTDIR), and a device "not a regular file", never read to the stream limit
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/fs.zig')
| -rw-r--r-- | src/fs.zig | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1521,6 +1521,13 @@ fn readFileLimit(gpa: std.mem.Allocator, path: []const u8, limit: usize) ![]u8 { }; defer _ = libc.close(fd); + // A device (/dev/zero, a tty) is no file to read whole: said so, not + // read to the stream limit and called too large. + if (ninep_io.statNoFollow(path_z)) |facts| { + const kind = facts.mode & 0o170000; + if (kind == 0o040000) return error.IsDirectory; + if (kind == 0o020000 or kind == 0o060000) return error.NotAFile; + } const end = libc.lseek(fd, 0, libc.SEEK.END); // Not seekable: a pipe or a FIFO is no file; a regular file that is a // stream (a 9ns mount's log or screen, opened nonseekable) is read to |
