summaryrefslogtreecommitdiff
path: root/usr.sbin/syslogd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-09-13 12:20:28 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-09-13 12:20:28 +0000
commitaf4d78d83f2ca37f825f0c195088c994d8edf70f (patch)
tree30d1a2e41d656df96cc24f86927d29ae0b765944 /usr.sbin/syslogd
parent6368edb9a9e210af310cbf07a2f62fbd0537bed5 (diff)
be more careful about f_file handling throughout
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r--usr.sbin/syslogd/syslogd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 2fc4cfb0b22..eaff42b62e4 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -519,6 +519,7 @@ logmsg(pri, msg, from, flags)
if (f->f_file >= 0) {
fprintlog(f, flags, msg);
(void)close(f->f_file);
+ f->f_file = -1;
}
(void)sigsetmask(omask);
return;
@@ -647,7 +648,10 @@ fprintlog(f, flags, msg)
(struct sockaddr *)&f->f_un.f_forw.f_addr,
sizeof(f->f_un.f_forw.f_addr)) != l) {
int e = errno;
- (void)close(f->f_file);
+ if (f->f_file >= 0) {
+ (void)close(f->f_file);
+ f->f_file = -1;
+ }
f->f_type = F_UNUSED;
errno = e;
logerror("sendto");
@@ -688,6 +692,7 @@ fprintlog(f, flags, msg)
goto again;
} else {
f->f_type = F_UNUSED;
+ f->f_file = -1;
errno = e;
logerror(f->f_un.f_fname);
}
@@ -1091,7 +1096,7 @@ cfline(line, f)
case '/':
(void)strcpy(f->f_un.f_fname, p);
if ((f->f_file = open(p, O_WRONLY|O_APPEND, 0)) < 0) {
- f->f_file = F_UNUSED;
+ f->f_type = F_UNUSED;
logerror(p);
break;
}