From 5daca02feaa90dcac68c03e479a0a61e51d2c7ca Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 29 Apr 2021 20:40:15 +0300 Subject: mail: accept attachments from FIFOs * mail/send.c: Use mu_file_stream_create for FIFOs. --- mail/send.c | 13 ++++++++----- 1 file 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"), -- cgit v1.2.1