aboutsummaryrefslogtreecommitdiff
path: root/butl
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-04-13 21:47:11 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-04-14 20:27:39 +0300
commit4408607c51a7c6e293adae41403b21d4a2c9a429 (patch)
tree9deb147c4928e6ebd5bd873779287098217d6c7e /butl
parentabbb859d9eefa62a5cc774bd08020bf30ad77c26 (diff)
Make sendmail ctor to close pipe's reading end explicitly
Diffstat (limited to 'butl')
-rw-r--r--butl/base642
-rw-r--r--butl/const-ptr2
-rw-r--r--butl/sendmail2
-rw-r--r--butl/sendmail.ixx31
-rw-r--r--butl/sha2562
-rw-r--r--butl/target-triplet2
-rw-r--r--butl/timestamp2
7 files changed, 23 insertions, 20 deletions
diff --git a/butl/base64 b/butl/base64
index b3e335a..1ba2fa1 100644
--- a/butl/base64
+++ b/butl/base64
@@ -45,6 +45,6 @@ namespace butl
LIBBUTL_EXPORT std::vector<char>
base64_decode (const std::string&);
-};
+}
#endif // BUTL_BASE64
diff --git a/butl/const-ptr b/butl/const-ptr
index 971e929..2790253 100644
--- a/butl/const-ptr
+++ b/butl/const-ptr
@@ -75,6 +75,6 @@ namespace butl
private:
T* p_;
};
-};
+}
#endif // BUTL_CONST_PTR
diff --git a/butl/sendmail b/butl/sendmail
index 5a380e7..706f110 100644
--- a/butl/sendmail
+++ b/butl/sendmail
@@ -32,7 +32,7 @@ namespace butl
//
// sm.out << "Test body" << endl;
//
- // sm.close ();
+ // sm.out.close ();
//
// if (!sm.wait ())
// ... // sendmail returned non-zero status.
diff --git a/butl/sendmail.ixx b/butl/sendmail.ixx
index 3f6597d..2e982c1 100644
--- a/butl/sendmail.ixx
+++ b/butl/sendmail.ixx
@@ -37,22 +37,25 @@ namespace butl
const recipients_type& bcc,
O&&... options)
{
- {
- fdpipe pipe (fdopen_pipe ()); // Text mode seems appropriate.
+ fdpipe pipe (fdopen_pipe ()); // Text mode seems appropriate.
- process& p (*this);
- p = process_start (cmdc,
- pipe.in,
- 2, // No output expected so redirect to stderr.
- std::forward<E> (err),
- dir_path (),
- "sendmail",
- "-i", // Don't treat '.' as the end of input.
- "-t", // Read recipients from headers.
- std::forward<O> (options)...);
+ process& p (*this);
+ p = process_start (cmdc,
+ pipe.in,
+ 2, // No output expected so redirect to stderr.
+ std::forward<E> (err),
+ dir_path (),
+ "sendmail",
+ "-i", // Don't treat '.' as the end of input.
+ "-t", // Read recipients from headers.
+ std::forward<O> (options)...);
- out.open (std::move (pipe.out));
- } // Close pipe.in.
+ // Close the reading end of the pipe not to block on writing if sendmail
+ // terminates before that.
+ //
+ pipe.in.close ();
+
+ out.open (std::move (pipe.out));
// Write headers.
//
diff --git a/butl/sha256 b/butl/sha256
index c6b2754..1c20a57 100644
--- a/butl/sha256
+++ b/butl/sha256
@@ -96,6 +96,6 @@ namespace butl
//
LIBBUTL_EXPORT std::string
fingerprint_to_sha256 (const std::string&);
-};
+}
#endif // BUTL_SHA256
diff --git a/butl/target-triplet b/butl/target-triplet
index fe5e728..284b47f 100644
--- a/butl/target-triplet
+++ b/butl/target-triplet
@@ -150,6 +150,6 @@ namespace butl
{
return o << x.string ();
}
-};
+}
#endif // BUTL_TARGET_TRIPLET
diff --git a/butl/timestamp b/butl/timestamp
index 550aa68..fde789f 100644
--- a/butl/timestamp
+++ b/butl/timestamp
@@ -141,6 +141,6 @@ namespace butl
const char* format,
bool local,
const char** end = nullptr);
-};
+}
#endif // BUTL_TIMESTAMP