summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-03-09 01:24:27 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-03-09 01:24:27 +0000
commit616c0abb0768f71a6f3153345389cdc0a713da95 (patch)
tree0a28beb449d13db0383531253184c4b96e16a85b /usr.sbin
parent54ef5f87f5fca3dc59e73858d7255df0659b77e8 (diff)
As pointed out by Perry, mailwrapper is never invoked directly,
err/warn will show names like sendmail, mailq, etc which is confusing. However, prefixing "mailwrapper" to the string passed to err/warn is ugly too. The least evil alternative seems to be to stash the value of __progname for checking and assign "mailwrapper" to __progname.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/mailwrapper/mailwrapper.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/mailwrapper/mailwrapper.c b/usr.sbin/mailwrapper/mailwrapper.c
index 1de63695ad3..7fafb23cdef 100644
--- a/usr.sbin/mailwrapper/mailwrapper.c
+++ b/usr.sbin/mailwrapper/mailwrapper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mailwrapper.c,v 1.14 2003/03/08 23:19:32 millert Exp $ */
+/* $OpenBSD: mailwrapper.c,v 1.15 2003/03/09 01:24:26 millert Exp $ */
/* $NetBSD: mailwrapper.c,v 1.2 1999/02/20 22:10:07 thorpej Exp $ */
/*
@@ -94,16 +94,21 @@ main(int argc, char *argv[], char *envp[])
{
FILE *config;
char *line, *cp, *from, *to, *ap;
+ const char *progname;
size_t len, lineno = 0;
struct arglist al;
+ /* change __progname to mailwrapper so we get sensible error messages */
+ progname = __progname;
+ __progname = "mailwrapper";
+
initarg(&al);
for (len = 0; len < argc; len++)
addarg(&al, argv[len], 0);
if ((config = fopen(_PATH_MAILERCONF, "r")) == NULL) {
addarg(&al, NULL, 0);
- openlog("mailwrapper", LOG_PID, LOG_MAIL);
+ openlog(__progname, LOG_PID, LOG_MAIL);
syslog(LOG_INFO, "cannot open %s, using %s as default MTA",
_PATH_MAILERCONF, _PATH_DEFAULTMTA);
closelog();
@@ -137,7 +142,7 @@ main(int argc, char *argv[], char *envp[])
if ((to = strsep(&cp, WS)) == NULL)
goto parse_error;
- if (strcmp(from, __progname) == 0) {
+ if (strcmp(from, progname) == 0) {
for (ap = strsep(&cp, WS); ap != NULL;
ap = strsep(&cp, WS))
if (*ap)