If /etc/mailer.conf doesn't exist, mailwrapper tries to run sendmail, giving a confusing error message:
mailwrapper: cannot exec /usr/libexec/sendmail/sendmail: No such file or directory This patch removes this fallback code. I believe this is cleaner than updating the fallback since we would have to put two paths in: one for sendmail/send-mail/mailq and one for makemap/newaliases. Index: mailwrapper.c =================================================================== RCS file: /cvs/src/usr.sbin/mailwrapper/mailwrapper.c,v retrieving revision 1.20 diff -u -p -r1.20 mailwrapper.c --- mailwrapper.c 12 Oct 2015 22:01:08 -0000 1.20 +++ mailwrapper.c 7 Dec 2015 21:33:57 -0000 @@ -36,12 +36,10 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> -#include <syslog.h> #include <unistd.h> #include <util.h> #define _PATH_MAILERCONF "/etc/mailer.conf" -#define _PATH_DEFAULTMTA "/usr/libexec/sendmail/sendmail" struct arglist { size_t argc, maxc; @@ -100,21 +98,11 @@ main(int argc, char *argv[], char *envp[ for (len = 0; len < argc; len++) addarg(&al, argv[len], 0); - config = fopen(_PATH_MAILERCONF, "r"); + if ((config = fopen(_PATH_MAILERCONF, "r")) == NULL) + err(1, "cannot open %s", _PATH_MAILERCONF); if (pledge("stdio exec", NULL) == -1) err(1, "pledge"); - - if (config == NULL) { - addarg(&al, NULL, 0); - openlog(__progname, LOG_PID, LOG_MAIL); - syslog(LOG_INFO, "cannot open %s, using %s as default MTA", - _PATH_MAILERCONF, _PATH_DEFAULTMTA); - closelog(); - execve(_PATH_DEFAULTMTA, al.argv, envp); - err(1, "cannot exec %s", _PATH_DEFAULTMTA); - /*NOTREACHED*/ - } for (;;) { if ((line = fparseln(config, &len, &lineno, NULL, 0)) == NULL) {