mblaze, a Maildir-focused command line mail client
 help / color / mirror / code / Atom feed
* [PATCH] blaze822: don't try to open /dev/stdin
@ 2022-05-23 17:09 Alyssa Ross
  2022-05-23 20:57 ` Leah Neukirchen
  0 siblings, 1 reply; 2+ messages in thread
From: Alyssa Ross @ 2022-05-23 17:09 UTC (permalink / raw)
  To: mblaze; +Cc: 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

-- 
You received this message because you are subscribed to the Google Groups "mblaze" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mblaze+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mblaze/20220523170921.2623516-1-hi%40alyssa.is.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] blaze822: don't try to open /dev/stdin
  2022-05-23 17:09 [PATCH] blaze822: don't try to open /dev/stdin Alyssa Ross
@ 2022-05-23 20:57 ` Leah Neukirchen
  0 siblings, 0 replies; 2+ messages in thread
From: Leah Neukirchen @ 2022-05-23 20:57 UTC (permalink / raw)
  To: Alyssa Ross; +Cc: mblaze

Alyssa Ross <hi@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  <leah@vuxu.org>  https://leahneukirchen.org/

-- 
You received this message because you are subscribed to the Google Groups "mblaze" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mblaze+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mblaze/87o7zoc6h3.fsf%40vuxu.org.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-23 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 17:09 [PATCH] blaze822: don't try to open /dev/stdin Alyssa Ross
2022-05-23 20:57 ` Leah Neukirchen

Code repositories for project(s) associated with this inbox:

	https://git.vuxu.org/mblaze/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).