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>
This commit is contained in:
parent
2b94c053d1
commit
4455cffa32
@ -6,7 +6,13 @@
|
||||
*
|
||||
* Licensed under GPLv2, see file LICENSE in this source tree.
|
||||
*/
|
||||
#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);
|
||||
|
Loading…
Reference in New Issue
Block a user