svn commit: r327494 - head/usr.sbin/mailwrapper
Baptiste Daroussin
bapt at FreeBSD.org
Tue Jan 2 16:50:59 UTC 2018
Author: bapt
Date: Tue Jan 2 16:50:57 2018
New Revision: 327494
URL: https://svnweb.freebsd.org/changeset/base/327494
Log:
Revert r326844
There has been some fallout from the change. The change itself was not valueable
enough to spend time investigating the corner cases, let's just back it out.
Reported by: flo
Modified:
head/usr.sbin/mailwrapper/Makefile
head/usr.sbin/mailwrapper/Makefile.depend
head/usr.sbin/mailwrapper/mailwrapper.c
Modified: head/usr.sbin/mailwrapper/Makefile
==============================================================================
--- head/usr.sbin/mailwrapper/Makefile Tue Jan 2 16:19:41 2018 (r327493)
+++ head/usr.sbin/mailwrapper/Makefile Tue Jan 2 16:50:57 2018 (r327494)
@@ -5,6 +5,8 @@
.if ${MK_MAILWRAPPER} != "no"
PROG= mailwrapper
MAN= mailwrapper.8
+
+LIBADD= util
.endif
.if ${MK_MAILWRAPPER} != "no" || ${MK_SENDMAIL} != "no"
Modified: head/usr.sbin/mailwrapper/Makefile.depend
==============================================================================
--- head/usr.sbin/mailwrapper/Makefile.depend Tue Jan 2 16:19:41 2018 (r327493)
+++ head/usr.sbin/mailwrapper/Makefile.depend Tue Jan 2 16:50:57 2018 (r327494)
@@ -7,7 +7,8 @@ DIRDEPS = \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
- lib/libcompiler_rt
+ lib/libcompiler_rt \
+ lib/libutil \
.include <dirdeps.mk>
Modified: head/usr.sbin/mailwrapper/mailwrapper.c
==============================================================================
--- head/usr.sbin/mailwrapper/mailwrapper.c Tue Jan 2 16:19:41 2018 (r327493)
+++ head/usr.sbin/mailwrapper/mailwrapper.c Tue Jan 2 16:50:57 2018 (r327494)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
+#include <libutil.h>
#include <sysexits.h>
#include <syslog.h>
@@ -88,17 +89,14 @@ int
main(int argc, char *argv[], char *envp[])
{
FILE *config;
- char *line, *cp, *from, *to, *ap, *walk;
+ char *line, *cp, *from, *to, *ap;
const char *progname;
char localmailerconf[MAXPATHLEN];
const char *mailerconf;
- size_t linecap = 0, lineno = 0;
- ssize_t linelen;
+ size_t len, lineno = 0;
int i;
struct arglist al;
- line = NULL;
-
/* change __progname to mailwrapper so we get sensible error messages */
progname = getprogname();
setprogname("mailwrapper");
@@ -125,16 +123,12 @@ main(int argc, char *argv[], char *envp[])
}
for (;;) {
- if ((linelen = getline(&line, &linecap, config)) <= 0) {
- if (feof(config)) {
+ if ((line = fparseln(config, &len, &lineno, NULL, 0)) == NULL) {
+ if (feof(config))
errx(EX_CONFIG, "no mapping in %s", mailerconf);
- }
err(EX_CONFIG, "cannot parse line %lu", (u_long)lineno);
}
- lineno++;
- walk = line;
- /* strip comments */
- strsep(&walk, "#");
+
#define WS " \t\n"
cp = line;
More information about the svn-src-all
mailing list