aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-05-23 17:09:21 +0000
committerLeah Neukirchen <leah@vuxu.org>2022-05-23 22:56:11 +0200
commitbb3dacc60498a096eda2dbd32cbbf65d0482fe99 (patch)
treea1c290d2c06dff6abd0d4d573cd3340815921d1a
parent793e22ecb7a8bf092ae0c2b46bfed9e039251ad8 (diff)
downloadmblaze-bb3dacc60498a096eda2dbd32cbbf65d0482fe99.tar.gz
mblaze-bb3dacc60498a096eda2dbd32cbbf65d0482fe99.tar.xz
mblaze-bb3dacc60498a096eda2dbd32cbbf65d0482fe99.zip
blaze822: don't try to open /dev/stdin
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. Message-Id: <20220523170921.2623516-1-hi@alyssa.is>
-rw-r--r--blaze822.c5
1 files changed, 4 insertions, 1 deletions
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;