Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102069500
D41367.id125720.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D41367.id125720.diff
View Options
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -135,6 +135,7 @@
#include <limits.h>
#include <netdb.h>
#include <paths.h>
+#include <regex.h>
#include <signal.h>
#include <stdbool.h>
#include <stddef.h>
@@ -144,7 +145,6 @@
#include <sysexits.h>
#include <unistd.h>
#include <utmpx.h>
-#include <regex.h>
#include "pathnames.h"
#include "ttymsg.h"
@@ -283,6 +283,11 @@
F_PIPE, /* pipe to program */
};
+static const char * const TypeNames[] = {
+ "UNUSED", "FILE", "TTY", "CONSOLE",
+ "FORW", "USERS", "WALL", "PIPE",
+};
+
/*
* This structure represents the files that will have log
* copies printed.
@@ -369,11 +374,6 @@
(f)->f_repeatcount = MAXREPEAT; \
} while (0)
-static const char *TypeNames[] = {
- "UNUSED", "FILE", "TTY", "CONSOLE",
- "FORW", "USERS", "WALL", "PIPE"
-};
-
static int sigcatch[] = {
SIGHUP, SIGINT, SIGQUIT,
SIGALRM, SIGTERM, SIGCHLD,
@@ -1553,7 +1553,7 @@
/* Behaviour on explicit match */
if (spec == NULL)
- return 0;
+ return (0);
switch (*spec) {
case '-':
exclude = 1;
@@ -1576,12 +1576,12 @@
if (prev == ',' && (next == '\0' || next == ','))
/* Explicit match: skip iff the spec is an
exclusive one. */
- return exclude;
+ return (exclude);
}
/* No explicit match for this name: skip the message iff
the spec is an inclusive one. */
- return !exclude;
+ return (!exclude);
}
/*
@@ -1834,8 +1834,8 @@
struct filed *f;
STAILQ_FOREACH(f, &fhead, next) {
- if ((f->f_type == F_FILE) &&
- (f->f_flags & FFLAG_NEEDSYNC)) {
+ if (f->f_type == F_FILE &&
+ (f->f_flags & FFLAG_NEEDSYNC) != 0) {
f->f_flags &= ~FFLAG_NEEDSYNC;
(void)fsync(f->f_file);
}
@@ -2310,7 +2310,7 @@
if ((sb.st_mode & S_IWGRP) == 0)
/* Messages disabled. */
return (NULL);
- return ttymsg(iov, iovcnt, line, tmout);
+ return (ttymsg(iov, iovcnt, line, tmout));
}
static void
@@ -2465,7 +2465,7 @@
/*
* Foreach line in the conf table, open that file.
*/
- include_len = sizeof(include_str) -1;
+ include_len = sizeof(include_str) - 1;
(void)strlcpy(host, "*", sizeof(host));
(void)strlcpy(prog, "*", sizeof(prog));
(void)strlcpy(pfilter, "*", sizeof(pfilter));
@@ -2477,7 +2477,7 @@
*/
for (p = cline; isspace(*p); ++p)
continue;
- if (*p == 0)
+ if (*p == '\0')
continue;
if (allow_includes &&
strncmp(p, include_str, include_len) == 0 &&
@@ -2524,7 +2524,7 @@
host[0] = *p++;
while (isspace(*p))
p++;
- if ((!*p) || (*p == '*')) {
+ if (*p == '\0' || *p == '*') {
(void)strlcpy(host, "*", sizeof(host));
continue;
}
@@ -2541,8 +2541,9 @@
}
if (*p == '!') {
p++;
- while (isspace(*p)) p++;
- if ((!*p) || (*p == '*')) {
+ while (isspace(*p))
+ p++;
+ if (*p == '\0' || *p == '*') {
(void)strlcpy(prog, "*", sizeof(prog));
continue;
}
@@ -2551,14 +2552,14 @@
break;
prog[i] = p[i];
}
- prog[i] = 0;
+ prog[i] = '\0';
continue;
}
if (*p == ':') {
p++;
while (isspace(*p))
p++;
- if ((!*p) || (*p == '*')) {
+ if (*p == '\0' || *p == '*') {
(void)strlcpy(pfilter, "*", sizeof(pfilter));
continue;
}
@@ -2818,11 +2819,11 @@
/* fill in prop_type */
if (strcasecmp(argv[0], "msg") == 0)
pfilter->prop_type = FILT_PROP_MSG;
- else if(strcasecmp(argv[0], "hostname") == 0)
+ else if (strcasecmp(argv[0], "hostname") == 0)
pfilter->prop_type = FILT_PROP_HOSTNAME;
- else if(strcasecmp(argv[0], "source") == 0)
+ else if (strcasecmp(argv[0], "source") == 0)
pfilter->prop_type = FILT_PROP_HOSTNAME;
- else if(strcasecmp(argv[0], "programname") == 0)
+ else if (strcasecmp(argv[0], "programname") == 0)
pfilter->prop_type = FILT_PROP_PROGNAME;
else {
logerror("unknown property");
@@ -2932,10 +2933,11 @@
{
struct filed *f;
struct addrinfo hints, *res;
- int error, i, pri, syncfile;
+ int error, i, pri;
const char *p, *q;
char *bp, *pfilter_dup;
char buf[LINE_MAX], ebuf[100];
+ bool syncfile;
dprintf("cfline(\"%s\", f, \"%s\", \"%s\", \"%s\")\n", line, prog,
host, pfilter);
@@ -3112,10 +3114,10 @@
p++;
if (*p == '-') {
- syncfile = 0;
+ syncfile = false;
p++;
} else
- syncfile = 1;
+ syncfile = true;
switch (*p) {
case '@':
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 5:57 AM (19 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14529120
Default Alt Text
D41367.id125720.diff (4 KB)
Attached To
Mode
D41367: syslogd: Style fixes
Attached
Detach File
Event Timeline
Log In to Comment