opnsense-src/libexec
Mateusz Piotrowski 4ff71ffaa7 rc.d/sendmail: Return non-zero if the daemon fails to start or is not running
If you have a mail server that is running sendmail daemon
(sendmail_enable=YES) and sendmail queue runner (sendmail_msp_queue=YES)
and the sendmail daemon dies, /etc/rc.d/sendmail status does see the
daemon is not running but returns 0 as the exit code.  This prevents
other programs (like puppet) from restarting sendmail to fix the issue.

Make sure that the exit code is propagated towards the end of the script
if any of the sendmail services fail.

This patch does not call exit directly but instead just sets the exit
status code by calling exit in a subshell. This way we do not exit the
current shell in case the service script is sourced (e.g., when
rc_fast_and_loose is active).

PR:		223132
MFC after:	2 weeks
Reported by:	pirzyk
Discussed with:	jilles, eugen
Reviewed by:	christos, gshapiro (previous version), markj
Approved by:	christos (mentor), markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D46862
Co-authored-by: Jim Pirzyk <pirzyk@FreeBSD.org>

(cherry picked from commit d2e7bb630b83848a774d8213014a9e0747775019)
2024-11-04 15:55:40 +01:00
..
atf Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
atrun Purge more stray embedded $FreeBSD$ strings 2023-10-24 10:10:12 -07:00
blacklistd-helper Track upstream project rename in contrib/blocklistd 2024-01-07 14:31:11 -05:00
bootpd bootpd(8): Fix a typo in a source code comment 2024-01-25 07:45:24 +01:00
comsat Purge more stray embedded $FreeBSD$ strings 2023-10-24 10:10:12 -07:00
dma dma.conf: Fix typo 2024-04-07 12:34:04 -04:00
fingerd Track upstream project rename in contrib/blocklistd 2024-01-07 14:31:11 -05:00
flua flua: Add wrappers for sys/utsname.h 2024-10-10 20:28:20 +00:00
ftpd Remove "All Rights Reserved" from FreeBSD Foundation copyrights 2024-08-06 15:39:53 -04:00
getty Purge more stray embedded $FreeBSD$ strings 2023-10-24 10:10:12 -07:00
hyperv Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
kgdb crashinfo: Print stack traces for all on-CPU threads 2024-02-09 09:55:45 -05:00
mail.local Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
makewhatis.local Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
mknetid Purge more stray embedded $FreeBSD$ strings 2023-10-24 10:10:12 -07:00
nuageinit nuageinit: tests: Cleanup 2024-10-08 09:04:02 +02:00
phttpget Remove remnants of portsnap(8) 2024-05-09 15:52:53 +09:00
pppoed Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
rbootd Purge more stray embedded $FreeBSD$ strings 2023-10-24 10:10:12 -07:00
rc rc.d/sendmail: Return non-zero if the daemon fails to start or is not running 2024-11-04 15:55:40 +01:00
revnetgroup Purge more stray embedded $FreeBSD$ strings 2023-10-24 10:10:12 -07:00
rpc.rquotad Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
rpc.rstatd Purge more stray embedded $FreeBSD$ strings 2023-10-24 10:10:12 -07:00
rpc.rusersd Purge more stray embedded $FreeBSD$ strings 2023-10-24 10:10:12 -07:00
rpc.rwalld Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
rpc.sprayd Purge more stray embedded $FreeBSD$ strings 2023-10-24 10:10:12 -07:00
rtld-elf Remove "All Rights Reserved" from FreeBSD Foundation copyrights 2024-08-06 15:39:53 -04:00
rtld-elf32 Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
save-entropy save-entropy: Add manual page 2024-05-03 17:25:24 -03:00
smrsh Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
talkd Purge more stray embedded $FreeBSD$ strings 2023-10-24 10:10:12 -07:00
tcpd Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
tests Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
tftp-proxy Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
tftpd tftpd: Code cleanup. 2024-07-09 23:40:26 +02:00
ulog-helper Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
ypxfr Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
Makefile nuageinit: add basic support for cloudinit. 2024-04-11 13:52:52 +02:00
Makefile.inc Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00