summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2021-04-29 20:40:15 +0300
committerSergey Poznyakoff <gray@gnu.org>2021-04-29 20:40:15 +0300
commit5daca02feaa90dcac68c03e479a0a61e51d2c7ca (patch)
treef3a9590142fe77c9e0a20be11dbb64eb3b565dc1
parent44a54b219c95f8d559111595370f278a6bf73d10 (diff)
downloadmailutils-5daca02feaa90dcac68c03e479a0a61e51d2c7ca.tar.gz
mailutils-5daca02feaa90dcac68c03e479a0a61e51d2c7ca.tar.bz2
mail: accept attachments from FIFOs
* mail/send.c: Use mu_file_stream_create for FIFOs.
-rw-r--r--mail/send.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/mail/send.c b/mail/send.c
index f2be36af4..1c33c0de5 100644
--- a/mail/send.c
+++ b/mail/send.c
@@ -235,7 +235,7 @@ attlist_attach_file (mu_list_t *attlist_ptr,
mu_stream_t stream = NULL;
char *id = NULL;
mu_list_t attlist;
-
+
if (fd >= 0)
{
rc = mu_fd_stream_create (&stream, NULL, fd, MU_STREAM_READ);
@@ -272,14 +272,17 @@ attlist_attach_file (mu_list_t *attlist_ptr,
return 1;
}
}
-
- if (!S_ISREG (st.st_mode))
+
+ if (S_ISREG (st.st_mode))
+ rc = mu_mapfile_stream_create (&stream, realname, MU_STREAM_READ);
+ else if (S_ISFIFO (st.st_mode))
+ rc = mu_file_stream_create (&stream, realname, MU_STREAM_READ);
+ else
{
- mu_error (_("%s: not a regular file"), realname);
+ mu_error (_("%s: not a regular file or FIFO"), realname);
return 1;
}
- rc = mu_mapfile_stream_create (&stream, realname, MU_STREAM_READ);
if (rc)
{
mu_error (_("can't open file %s: %s"),

Return to:

Send suggestions and report system problems to the System administrator.