Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/mailwrapper Revert previous changes. Add a comment ...
details: https://anonhg.NetBSD.org/src/rev/bf7a04d3ee8b
branches: trunk
changeset: 544035:bf7a04d3ee8b
user: mjl <mjl%NetBSD.org@localhost>
date: Sun Mar 09 08:10:43 2003 +0000
description:
Revert previous changes. Add a comment to the source explaining the
reason things are as they are -- Perry said:
This (using err("mailwrapper")) is intentional. Mailwrapper plays ugly
games with argv[0] and thus it is often difficult for people to know
that the error isn't from "mailq" or "sendmail" but from
mailwrapper -- having mailwrapper add an indication that it was really
mailwrapper running was a requested feature.
diffstat:
usr.sbin/mailwrapper/mailwrapper.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diffs (71 lines):
diff -r d8a13c8c8bd3 -r bf7a04d3ee8b usr.sbin/mailwrapper/mailwrapper.c
--- a/usr.sbin/mailwrapper/mailwrapper.c Sun Mar 09 01:55:48 2003 +0000
+++ b/usr.sbin/mailwrapper/mailwrapper.c Sun Mar 09 08:10:43 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mailwrapper.c,v 1.8 2003/03/08 22:57:51 mjl Exp $ */
+/* $NetBSD: mailwrapper.c,v 1.9 2003/03/09 08:10:43 mjl Exp $ */
/*
* Copyright (c) 1998
@@ -56,7 +56,15 @@
al->argc = 0;
al->maxc = 10;
if ((al->argv = malloc(al->maxc * sizeof(char *))) == NULL)
- err(1, "malloc");
+ /*
+ * This (using err("mailwrapper")) is intentional.
+ * Mailwrapper plays ugly games with argv[0] and thus it
+ * is often difficult for people to know that the error
+ * isn't from "mailq" or "sendmail" but from mailwrapper
+ * -- having mailwrapper add an indication that it was really
+ * mailwrapper running was a requested feature.
+ */
+ err(1, "mailwrapper");
}
static void
@@ -69,11 +77,11 @@
al->maxc <<= 1;
if ((al->argv = realloc(al->argv,
al->maxc * sizeof(char *))) == NULL)
- err(1, "realloc");
+ err(1, "mailwrapper");
}
if (copy) {
if ((al->argv[al->argc++] = strdup(arg)) == NULL)
- err(1, "strdup");
+ err(1, "mailwrapper:");
} else
al->argv[al->argc++] = (char *)arg;
}
@@ -94,13 +102,14 @@
addarg(&al, argv[0], 0);
if ((config = fopen(_PATH_MAILERCONF, "r")) == NULL)
- err(1, "can't open %s", _PATH_MAILERCONF);
+ err(1, "mailwrapper: can't open %s", _PATH_MAILERCONF);
for (;;) {
if ((line = fparseln(config, &len, &lineno, NULL, 0)) == NULL) {
if (feof(config))
- errx(1, "no mapping in %s", _PATH_MAILERCONF);
- err(1, "fparseln");
+ errx(1, "mailwrapper: no mapping in %s",
+ _PATH_MAILERCONF);
+ err(1, "mailwrapper");
}
#define WS " \t\n"
@@ -139,10 +148,10 @@
addarg(&al, NULL, 0);
execve(to, al.argv, envp);
- err(1, "execing %s", to);
+ err(1, "mailwrapper: execing %s", to);
/*NOTREACHED*/
parse_error:
- errx(1, "parse error in %s at line %lu",
+ errx(1, "mailwrapper: parse error in %s at line %lu",
_PATH_MAILERCONF, (u_long)lineno);
/*NOTREACHED*/
}
Home |
Main Index |
Thread Index |
Old Index