From owner-svn-src-head@freebsd.org Tue Jan 2 16:50:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0474EEAEA6E; Tue, 2 Jan 2018 16:50:59 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF59A68C6A; Tue, 2 Jan 2018 16:50:58 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w02GovIr052195; Tue, 2 Jan 2018 16:50:57 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w02GovpW052192; Tue, 2 Jan 2018 16:50:57 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201801021650.w02GovpW052192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 2 Jan 2018 16:50:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327494 - head/usr.sbin/mailwrapper X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/usr.sbin/mailwrapper X-SVN-Commit-Revision: 327494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jan 2018 16:50:59 -0000 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 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 #include #include +#include #include #include @@ -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;