[PATCH] blaze822: don't try to open /dev/stdin

2 views
Skip to first unread message

Alyssa Ross

unread,
May 23, 2022, 1:09:31 PM5/23/22
to mbl...@googlegroups.com, Alyssa Ross
Use the same check is blaze822() as in blaze822_file() to ensure that
we don't try to open /dev/stdin, which is non-POSIX.
---
blaze822.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/blaze822.c b/blaze822.c
index 9262f6f..47f03a2 100644
--- a/blaze822.c
+++ b/blaze822.c
@@ -443,7 +443,10 @@ blaze822(char *file)
if (!mesg)
return 0;

- fd = open(file, O_RDONLY);
+ if (strcmp(file, "/dev/stdin") == 0)
+ fd = dup(0);
+ else
+ fd = open(file, O_RDONLY);
if (fd < 0) {
free(mesg);
return 0;
--
2.35.1

Leah Neukirchen

unread,
May 23, 2022, 4:57:36 PM5/23/22
to Alyssa Ross, mbl...@googlegroups.com
Alyssa Ross <h...@alyssa.is> writes:

> Use the same check is blaze822() as in blaze822_file() to ensure that
> we don't try to open /dev/stdin, which is non-POSIX.

Thanks, applied.

--
Leah Neukirchen <le...@vuxu.org> https://leahneukirchen.org/
Reply all
Reply to author
Forward
0 new messages