Page MenuHomeFreeBSD

syslogd: Read configuration outside of init loop
ClosedPublic

Authored by jfree on Aug 8 2023, 2:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 21, 3:52 AM
Unknown Object (File)
Mon, Oct 21, 3:52 AM
Unknown Object (File)
Wed, Oct 16, 6:51 AM
Unknown Object (File)
Sep 22 2024, 5:25 AM
Unknown Object (File)
Sep 19 2024, 5:22 AM
Unknown Object (File)
Sep 18 2024, 11:58 PM
Unknown Object (File)
Sep 18 2024, 6:24 AM
Unknown Object (File)
Sep 18 2024, 12:59 AM
Subscribers

Details

Summary
Move all configuration-file code outside of the initialization loop and
into its own set of functions. Create a readconfigfile() to open the
config and call parseconfigfile() to parse it.

The init() function no longer returns if there was a failure to open the
configuration file. Initialization will be finished, using the backup
logging rules: *.ERR to /dev/console and *.PANIC to all logged in users.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

usr.sbin/syslogd/syslogd.c
2468

This inverts the flag, but the commit message makes this seem unintentional.

2662

We no longer return early in this case. I think that's probably ok though?

usr.sbin/syslogd/syslogd.c
2468

This inverts the flag, but the commit message makes this seem unintentional.

Ah, I ended up removing the allow_includes parameter later because of this unintentional flip.

I don't see why recursive includes would be an issue, unless you had an inclusion loop. Maybe this is there to mitigate that?

2662

We no longer return early in this case. I think that's probably ok though?

Yeah, I went through the logic when I made this change. There shouldn't be an error in removing the early return.

usr.sbin/syslogd/syslogd.c
2468

Yes, I'm fairly sure this is a low-tech mechanism to avoid infinite loops.

2662

Ok. In general I would suggest including this kind of information in the review/commit description, since otherwise it's hard to tell if this is intentional or not.

Address Mark's suggestions

markj added inline comments.
usr.sbin/syslogd/syslogd.c
2549

I would drop this comment too, in the spirit of "comments should explain why, not what."

This revision is now accepted and ready to land.Aug 11 2023, 2:30 PM

Remove comment in readconfigfile()

This revision now requires review to proceed.Aug 11 2023, 5:56 PM
This revision is now accepted and ready to land.Aug 14 2023, 1:55 PM
This revision was automatically updated to reflect the committed changes.