From fc6f690727aac2b5c9bd368f9b13188fb0ba36a7 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 16 Jul 2026 13:07:28 +0200 Subject: fs: reject open()/read() on a directory (EISDIR) open() now checks the target's inode type: opening a directory as a file returns $FE (EISDIR) instead of a valid fd, so 'cat docs' no longer streams the raw directory block as bytes. cat reports 'is a directory'; wc/head/save treat any invalid fd (>3) as an open failure. (ls is unaffected - it uses the structural opendir/list path, not open/getb.) --- c/gbos.h | 1 + 1 file changed, 1 insertion(+) (limited to 'c/gbos.h') diff --git a/c/gbos.h b/c/gbos.h index c93414f..2a99c0e 100644 --- a/c/gbos.h +++ b/c/gbos.h @@ -34,6 +34,7 @@ void poweroff(void); /* clean emulator shutdown (saves) */ #define O_READ 0 #define O_WRITE 1 #define NOFD 0xFF +#define EISDIR 0xFE /* open() failed: path is a directory */ /* process control (c/libc.s) */ unsigned char fork(void); -- cgit v1.3.1-sl0p