mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 12:28:58 +00:00
Introduce to the !program specification a capability similar to the one
that already exists for hosts: being able to specify a section that applies to every program *except* the one in question. The normal syntax for program specification is still valid. For the new capability, one uses: !-program Since there is no way to specify a program beginning with a dash in the old syntax, as it would be interpreted as the case above, the following alternative syntax to the original capability is provided: !+program This shouldn't introduce incompatibilities with any syslogd configuration in production because -stable's syslogd does not support a dash anywhere in the program specification. MFC after: 2 weeks
This commit is contained in:
parent
4712aa3b59
commit
f50b861cbf
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103855
@ -185,6 +185,17 @@ specification for
|
||||
.Ql foo
|
||||
will also match any message logged by the kernel with the prefix
|
||||
.Ql "foo: " .
|
||||
The
|
||||
.Ql #!+prog
|
||||
or
|
||||
.Ql !+prog
|
||||
specification works just like the previous one,
|
||||
and the
|
||||
.Ql #!-prog
|
||||
or
|
||||
.Ql !-prog
|
||||
specification will match any message but the ones from that
|
||||
program.
|
||||
A
|
||||
.Em hostname
|
||||
specification of the form
|
||||
|
@ -853,8 +853,20 @@ logmsg(int pri, const char *msg, const char *from, int flags)
|
||||
|
||||
/* skip messages with the incorrect program name */
|
||||
if (f->f_program)
|
||||
if (strcmp(prog, f->f_program) != 0)
|
||||
continue;
|
||||
switch (f->f_program[0]) {
|
||||
case '+':
|
||||
if (strcmp(prog, f->f_program + 1) != 0)
|
||||
continue;
|
||||
break;
|
||||
case '-':
|
||||
if (strcmp(prog, f->f_program + 1) == 0)
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
if (strcmp(prog, f->f_program) != 0)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
if (f->f_type == F_CONSOLE && (flags & IGN_CONS))
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user