diff options
author | Mark Johnston <markjdb@gmail.com> | 2023-09-01 02:48:18 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2023-09-28 15:51:52 +0000 |
commit | 518bd54167a8990d1233f216d9ecd0db68f7bf81 (patch) | |
tree | 79566a06824a7bc84f33c7ee221c6aed764aedd3 /usr.sbin/syslogd/syslogd.c | |
parent | 8d7a48d367ffde2a29419ef943c4099984e3af4d (diff) | |
download | src-518bd54167a8990d1233f216d9ecd0db68f7bf81.tar.gz src-518bd54167a8990d1233f216d9ecd0db68f7bf81.zip |
syslogd: Fix fd type, add enum for filed types
Reviewed by: markj, emaste
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41357
Diffstat (limited to 'usr.sbin/syslogd/syslogd.c')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index de3d7c106f8a..701b062802b0 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -247,6 +247,17 @@ struct prop_filter { size_t pflt_strlen; }; +enum f_type { + F_UNUSED, /* unused entry */ + F_FILE, /* regular file */ + F_TTY, /* terminal */ + F_CONSOLE, /* console terminal */ + F_FORW, /* remote machine */ + F_USERS, /* list of users */ + F_WALL, /* everyone logged on */ + F_PIPE, /* pipe to program */ +}; + /* * This structure represents the files that will have log * copies printed. @@ -256,8 +267,8 @@ struct prop_filter { struct filed { STAILQ_ENTRY(filed) next; /* next in linked list */ - short f_type; /* entry type, see below */ - short f_file; /* file descriptor */ + enum f_type f_type; + int f_file; /* file descriptor */ time_t f_time; /* time this was last written */ char *f_host; /* host from which to recd. */ u_char f_pmask[LOG_NFACILITIES+1]; /* priority mask */ @@ -351,16 +362,6 @@ static int repeatinterval[] = { 30, 120, 600 }; /* # of secs before flush */ (f)->f_repeatcount = MAXREPEAT; \ } while (0) -/* values for f_type */ -#define F_UNUSED 0 /* unused entry */ -#define F_FILE 1 /* regular file */ -#define F_TTY 2 /* terminal */ -#define F_CONSOLE 3 /* console terminal */ -#define F_FORW 4 /* remote machine */ -#define F_USERS 5 /* list of users */ -#define F_WALL 6 /* everyone logged on */ -#define F_PIPE 7 /* pipe to program */ - static const char *TypeNames[] = { "UNUSED", "FILE", "TTY", "CONSOLE", "FORW", "USERS", "WALL", "PIPE" @@ -472,7 +473,6 @@ close_filed(struct filed *f) f->fu_forw_addr = NULL; } /* FALLTHROUGH */ - case F_FILE: case F_TTY: case F_CONSOLE: @@ -481,6 +481,8 @@ close_filed(struct filed *f) case F_PIPE: f->fu_pipe_pid = 0; break; + default: + break; } (void)close(f->f_file); f->f_file = -1; @@ -1978,6 +1980,8 @@ fprintlog_write(struct filed *f, struct iovlist *il, int flags) iovlist_append(il, "\r\n"); wallmsg(f, il->iov, il->iovcnt); break; + default: + break; } } @@ -2616,6 +2620,8 @@ init(int signo) deadq_enter(f->fu_pipe_pid, f->fu_pipe_pname); close_filed(f); break; + default: + break; } } while(!STAILQ_EMPTY(&fhead)) { @@ -2713,6 +2719,8 @@ init(int signo) for (i = 0; i < MAXUNAMES && *f->fu_uname[i]; i++) printf("%s, ", f->fu_uname[i]); break; + default: + break; } if (f->f_program) printf(" (%s)", f->f_program); |