Hi, The prototype for main() is inherited from the import of mailwrapper back in 1999. While at it, my understanding is that the envp argument can also be removed since the environ is unaltered. This however requires changing the calls from execve() to execv(). Where execv() is appropriate since every entry in /etc/mailer.conf should resolve to an executable path as I read it the manual.
Comments? OK? Index: mailwrapper.c =================================================================== RCS file: /cvs/src/usr.sbin/mailwrapper/mailwrapper.c,v retrieving revision 1.22 diff -u -p -r1.22 mailwrapper.c --- mailwrapper.c 28 Dec 2015 16:27:28 -0000 1.22 +++ mailwrapper.c 13 Jun 2017 18:00:24 -0000 @@ -48,8 +48,6 @@ struct arglist { char **argv; }; -int main(int, char *[], char *[]); - static void initarg(struct arglist *); static void addarg(struct arglist *, const char *); @@ -78,7 +76,7 @@ addarg(struct arglist *al, const char *a } int -main(int argc, char *argv[], char *envp[]) +main(int argc, char *argv[]) { FILE *config; char *line, *cp, *from, *to, *ap; @@ -108,7 +106,7 @@ main(int argc, char *argv[], char *envp[ syslog(LOG_INFO, "cannot open %s, using %s as default MTA", _PATH_MAILERCONF, _PATH_DEFAULTMTA); closelog(); - execve(_PATH_DEFAULTMTA, al.argv, envp); + execv(_PATH_DEFAULTMTA, al.argv); err(1, "cannot exec %s", _PATH_DEFAULTMTA); /*NOTREACHED*/ } @@ -153,7 +151,7 @@ main(int argc, char *argv[], char *envp[ addarg(&al, NULL); - execve(to, al.argv, envp); + execv(to, al.argv); err(1, "cannot exec %s", to); /*NOTREACHED*/ parse_error: