summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)