diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-09-15 09:37:25 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-09-15 09:37:25 +0000 |
commit | 37af2f62f00d87cafd1e8157c892d80eaf970b9d (patch) | |
tree | df003da5ee06a1f398430e6cc9755d7105765a8f /usr.sbin | |
parent | edb0bb62c5c15f71d9a0618f03036c60735a62cb (diff) |
F_FORW has no associated fd; init sin_len too
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index eaff42b62e4..3362c05d417 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -287,6 +287,7 @@ main(argc, argv) die(0); } memset(&sin, 0, sizeof(sin)); + sin.sin_len = sizeof(sin); sin.sin_family = AF_INET; sin.sin_port = LogPort = sp->s_port; if (bind(finet, (struct sockaddr *)&sin, sizeof(sin)) < 0) { @@ -647,13 +648,7 @@ fprintlog(f, flags, msg) if (sendto(finet, line, l, 0, (struct sockaddr *)&f->f_un.f_forw.f_addr, sizeof(f->f_un.f_forw.f_addr)) != l) { - int e = errno; - if (f->f_file >= 0) { - (void)close(f->f_file); - f->f_file = -1; - } f->f_type = F_UNUSED; - errno = e; logerror("sendto"); } break; @@ -905,9 +900,10 @@ init(signo) case F_FILE: case F_TTY: case F_CONSOLE: - case F_FORW: (void)close(f->f_file); break; + case F_FORW: + break; } next = f->f_next; free((char *)f); @@ -1086,10 +1082,12 @@ cfline(line, f) break; } memset(&f->f_un.f_forw.f_addr, 0, - sizeof(f->f_un.f_forw.f_addr)); + sizeof(f->f_un.f_forw.f_addr)); + f->f_un.f_forw.f_addr.sin_len = sizeof(f->f_un.f_forw.f_addr); f->f_un.f_forw.f_addr.sin_family = AF_INET; f->f_un.f_forw.f_addr.sin_port = LogPort; - memmove(&f->f_un.f_forw.f_addr.sin_addr, hp->h_addr, hp->h_length); + memmove(&f->f_un.f_forw.f_addr.sin_addr, hp->h_addr, + hp->h_length); f->f_type = F_FORW; break; |