aboutsummaryrefslogtreecommitdiff
path: root/mailutils
diff options
context:
space:
mode:
authorAlex Samorukov <samm@os2.kiev.ua>2021-01-04 01:18:44 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2021-01-04 13:28:31 +0100
commit4455cffa3226cd58bf48f378d24aebf1b7033ddf (patch)
treeb36536d194c57fb838aa4e81d2b96f21300df9af /mailutils
parent2b94c053d1c2a0db88dbc4e1e470ae17c616ed92 (diff)
downloadbusybox-4455cffa3226cd58bf48f378d24aebf1b7033ddf.tar.gz
Fix mail compilation on the FreeBSD
FreeBSD using procctl instead of Linux prctl Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'mailutils')
-rw-r--r--mailutils/mail.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/mailutils/mail.c b/mailutils/mail.c
index 61e5053bc..f48b41bab 100644
--- a/mailutils/mail.c
+++ b/mailutils/mail.c
@@ -6,7 +6,13 @@
*
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
-#include <sys/prctl.h>
+#if defined(__linux__)
+# include <sys/prctl.h>
+# define PRCTL
+#elif defined(__FreeBSD__)
+# include <sys/procctl.h>
+# define PROCCTL
+#endif
#include "libbb.h"
#include "mail.h"
@@ -55,7 +61,14 @@ void FAST_FUNC launch_helper(const char **argv)
xmove_fd(child_in.rd, STDIN_FILENO);
xmove_fd(child_out.wr, STDOUT_FILENO);
// if parent dies, get SIGTERM
+#if defined(PRCTL)
prctl(PR_SET_PDEATHSIG, SIGTERM, 0, 0, 0);
+#elif defined(PROCCTL)
+ {
+ int signum = SIGTERM;
+ procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum);
+ }
+#endif
// try to execute connection helper
// NB: SIGCHLD & SIGALRM revert to SIG_DFL on exec
BB_EXECVP_or_die((char**)argv);