Date: Thu, 30 Jul 2015 05:13:13 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286065 - user/ngie/more-tests/usr.sbin/syslogd Message-ID: <201507300513.t6U5DDUD041580@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Thu Jul 30 05:13:12 2015 New Revision: 286065 URL: https://svnweb.freebsd.org/changeset/base/286065 Log: Revert local change accidentally committed with r285905 Modified: user/ngie/more-tests/usr.sbin/syslogd/syslogd.c Modified: user/ngie/more-tests/usr.sbin/syslogd/syslogd.c ============================================================================== --- user/ngie/more-tests/usr.sbin/syslogd/syslogd.c Thu Jul 30 04:53:53 2015 (r286064) +++ user/ngie/more-tests/usr.sbin/syslogd/syslogd.c Thu Jul 30 05:13:12 2015 (r286065) @@ -349,22 +349,6 @@ static int waitdaemon(int, int, int); static void timedout(int); static void increase_rcvbuf(int); -static void -close_filed(struct filed *f) -{ - int saved_errno; - - if (f == NULL || f->f_file == -1) - return; - - saved_errno = errno; - - close(f->f_file); - f->f_file = -1; - f->f_type = F_UNUSED; - errno = saved_errno; -} - int main(int argc, char *argv[]) { @@ -1041,7 +1025,6 @@ logmsg(int pri, const char *msg, const c sizeof(f->f_lasttime)); fprintlog(f, flags, msg); (void)close(f->f_file); - f->f_file = -1; } (void)sigsetmask(omask); return; @@ -1330,7 +1313,8 @@ fprintlog(struct filed *f, int flags, co */ if (errno != ENOSPC) { int e = errno; - close_filed(f); + (void)close(f->f_file); + f->f_type = F_UNUSED; errno = e; logerror(f->f_un.f_fname); } @@ -1353,11 +1337,13 @@ fprintlog(struct filed *f, int flags, co } } if (writev(f->f_file, iov, IOV_SIZE) < 0) { - close_filed(f); + int e = errno; + (void)close(f->f_file); if (f->f_un.f_pipe.f_pid > 0) deadq_enter(f->f_un.f_pipe.f_pid, f->f_un.f_pipe.f_pname); f->f_un.f_pipe.f_pid = 0; + errno = e; logerror(f->f_un.f_pipe.f_pname); } break; @@ -1460,7 +1446,7 @@ reapchild(int signo __unused) for (f = Files; f; f = f->f_next) if (f->f_type == F_PIPE && f->f_un.f_pipe.f_pid == pid) { - close_filed(f); + (void)close(f->f_file); f->f_un.f_pipe.f_pid = 0; log_deadchild(pid, status, f->f_un.f_pipe.f_pname); @@ -1564,7 +1550,7 @@ die(int signo) if (f->f_prevcount) fprintlog(f, 0, (char *)NULL); if (f->f_type == F_PIPE && f->f_un.f_pipe.f_pid > 0) { - close_filed(f); + (void)close(f->f_file); f->f_un.f_pipe.f_pid = 0; } } @@ -1649,11 +1635,10 @@ init(int signo) case F_CONSOLE: case F_TTY: (void)close(f->f_file); - f->f_file = -1; break; case F_PIPE: if (f->f_un.f_pipe.f_pid > 0) { - close_filed(f); + (void)close(f->f_file); deadq_enter(f->f_un.f_pipe.f_pid, f->f_un.f_pipe.f_pname); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507300513.t6U5DDUD041580>