From e61f8826a78ce9558416a48275729b6bdcabfb7c Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 24 Jun 2025 03:07:47 -0400 Subject: usr.bin: osh: Skip blank newlines in scripts Signed-off-by: Ian Moffett --- usr.bin/osh/osh.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.bin/osh/osh.c b/usr.bin/osh/osh.c index d458173..47ea695 100644 --- a/usr.bin/osh/osh.c +++ b/usr.bin/osh/osh.c @@ -310,6 +310,11 @@ open_script(const char *pathname) } while (read(fd, &c, 1) > 0) { + /* Skip blank newlines */ + if (c == '\n' && buf_i == 0) { + continue; + } + if (buf_i >= sizeof(buf) - 1) { buf_i = 0; } -- cgit v1.2.3