Blob Blame History Raw
From 4a92d7ca417a0ebaf92c25c2e9235a9a568e6ba3 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 16 Mar 2016 09:19:36 +0100
Subject: [PATCH] mailx: stop creating dead.letter on mailx failures

SELinux does not like mailx creating the file and I do not see any
reason to create the file in a problem directory because the file
contains a copy of the email that could not be send.

Failures of EVENT=notify are discoverable in system logs and if you run
the reporter manually, you will see that mailx failed.

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
 src/plugins/reporter-mailx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/plugins/reporter-mailx.c b/src/plugins/reporter-mailx.c
index 47943ed..8ab6733 100644
--- a/src/plugins/reporter-mailx.c
+++ b/src/plugins/reporter-mailx.c
@@ -132,6 +132,12 @@ static void create_and_send_email(
      */
     putenv((char*)"sendwait=1");
 
+    /* Prevent mailx from creating dead.letter if sending fails. The file is
+     * useless in our case and if the reporter is called from abrtd, SELinux
+     * complains a lot about mailx touching ABRT data.
+     */
+    putenv((char*)"DEAD=/dev/null");
+
     if (notify_only)
         log(_("Sending a notification email to: %s"), email_to);
     else
-- 
2.5.5