From owner-svn-src-stable@FreeBSD.ORG Tue Mar 24 01:56:16 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99467106566B; Tue, 24 Mar 2009 01:56:16 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85AC18FC18; Tue, 24 Mar 2009 01:56:16 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O1uGMs028960; Tue, 24 Mar 2009 01:56:16 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O1uGXF028958; Tue, 24 Mar 2009 01:56:16 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <200903240156.n2O1uGXF028958@svn.freebsd.org> From: "David E. O'Brien" Date: Tue, 24 Mar 2009 01:56:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190359 - stable/7/usr.sbin/syslogd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Mar 2009 01:56:17 -0000 Author: obrien Date: Tue Mar 24 01:56:16 2009 New Revision: 190359 URL: http://svn.freebsd.org/changeset/base/190359 Log: MFC: r186234/r186236: Use passed parameter rather than a hard coded value. Bump WARNS to 3. Modified: stable/7/usr.sbin/syslogd/ (props changed) stable/7/usr.sbin/syslogd/Makefile stable/7/usr.sbin/syslogd/syslogd.c Modified: stable/7/usr.sbin/syslogd/Makefile ============================================================================== --- stable/7/usr.sbin/syslogd/Makefile Tue Mar 24 01:54:17 2009 (r190358) +++ stable/7/usr.sbin/syslogd/Makefile Tue Mar 24 01:56:16 2009 (r190359) @@ -12,7 +12,7 @@ SRCS= syslogd.c ttymsg.c DPADD= ${LIBUTIL} LDADD= -lutil -WARNS?= 1 +WARNS?= 3 .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 Modified: stable/7/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/7/usr.sbin/syslogd/syslogd.c Tue Mar 24 01:54:17 2009 (r190358) +++ stable/7/usr.sbin/syslogd/syslogd.c Tue Mar 24 01:56:16 2009 (r190359) @@ -330,7 +330,7 @@ static void reapchild(int); static void usage(void); static int validate(struct sockaddr *, const char *); static void unmapped(struct sockaddr *); -static void wallmsg(struct filed *, struct iovec *); +static void wallmsg(struct filed *, struct iovec *, const int iovlen); static int waitdaemon(int, int, int); static void timedout(int); static void double_rbuf(int); @@ -1060,10 +1060,11 @@ dofsync(void) } } +#define IOV_SIZE 7 static void fprintlog(struct filed *f, int flags, const char *msg) { - struct iovec iov[7]; + struct iovec iov[IOV_SIZE]; struct iovec *v; struct addrinfo *r; int i, l, lsent = 0; @@ -1248,7 +1249,7 @@ fprintlog(struct filed *f, int flags, co dprintf(" %s\n", f->f_un.f_fname); v->iov_base = lf; v->iov_len = 1; - if (writev(f->f_file, iov, 7) < 0) { + if (writev(f->f_file, iov, IOV_SIZE) < 0) { /* * If writev(2) fails for potentially transient errors * like the filesystem being full, ignore it. @@ -1279,7 +1280,7 @@ fprintlog(struct filed *f, int flags, co break; } } - if (writev(f->f_file, iov, 7) < 0) { + if (writev(f->f_file, iov, IOV_SIZE) < 0) { int e = errno; (void)close(f->f_file); if (f->f_un.f_pipe.f_pid > 0) @@ -1304,7 +1305,7 @@ fprintlog(struct filed *f, int flags, co v->iov_len = 2; errno = 0; /* ttymsg() only sometimes returns an errno */ - if ((msgret = ttymsg(iov, 7, f->f_un.f_fname, 10))) { + if ((msgret = ttymsg(iov, IOV_SIZE, f->f_un.f_fname, 10))) { f->f_type = F_UNUSED; logerror(msgret); } @@ -1315,7 +1316,7 @@ fprintlog(struct filed *f, int flags, co dprintf("\n"); v->iov_base = crlf; v->iov_len = 2; - wallmsg(f, iov); + wallmsg(f, iov, IOV_SIZE); break; } f->f_prevcount = 0; @@ -1329,7 +1330,7 @@ fprintlog(struct filed *f, int flags, co * world, or a list of approved users. */ static void -wallmsg(struct filed *f, struct iovec *iov) +wallmsg(struct filed *f, struct iovec *iov, const int iovlen) { static int reenter; /* avoid calling ourselves */ FILE *uf; @@ -1353,7 +1354,8 @@ wallmsg(struct filed *f, struct iovec *i strncpy(line, ut.ut_line, sizeof(line) - 1); line[sizeof(line) - 1] = '\0'; if (f->f_type == F_WALL) { - if ((p = ttymsg(iov, 7, line, TTYMSGTIME)) != NULL) { + if ((p = ttymsg(iov, iovlen, line, TTYMSGTIME)) != + NULL) { errno = 0; /* already in msg */ logerror(p); } @@ -1365,8 +1367,8 @@ wallmsg(struct filed *f, struct iovec *i break; if (!strncmp(f->f_un.f_uname[i], ut.ut_name, UT_NAMESIZE)) { - if ((p = ttymsg(iov, 7, line, TTYMSGTIME)) - != NULL) { + if ((p = ttymsg(iov, iovlen, line, TTYMSGTIME)) + != NULL) { errno = 0; /* already in msg */ logerror(p); }