mblaze, a Maildir-focused command line mail client
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: mblaze@googlegroups.com
Cc: Alyssa Ross <hi@alyssa.is>
Subject: [PATCH] blaze822: don't try to open /dev/stdin
Date: Mon, 23 May 2022 17:09:21 +0000	[thread overview]
Message-ID: <20220523170921.2623516-1-hi@alyssa.is> (raw)

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.

             reply	other threads:[~2022-05-23 17:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 17:09 Alyssa Ross [this message]
2022-05-23 20:57 ` Leah Neukirchen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220523170921.2623516-1-hi@alyssa.is \
    --to=hi@alyssa.is \
    --cc=mblaze@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).