bozo: Properly detect presence of -auditlog 02/14402/3
authorAndrew Deason <adeason@sinenomine.net>
Sun, 18 Oct 2020 01:51:51 +0000 (20:51 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Sun, 25 Oct 2020 20:57:50 +0000 (16:57 -0400)
commit87041d676c93dfe35a085b9b5aaa73e74c08bc90
tree79c5535bd0ce827f25a090864db97f7578797467
parente8702e6a615a160cdbe464f76bd6f100667720d2
bozo: Properly detect presence of -auditlog

cmd_OptionAsString returns non-zero if the given option _isn't_ given
(CMD_MISSING), so we need to call osi_audit_file only when
cmd_OptionAsString returns 0. Since commit
f6cdf71 (bozo: Use libcmd for command line options), this causes
bosserver to complain on startup if no -auditlog was given:

    $ bosserver
    Warning: auditlog (null) not writable, ignored.

To fix this, skip calling osi_audit_file if -auditlog was not given.

While we're changing this anyway, change our processing of our
audit-related options to more closely match what other daemons do,
like ptserver or viced, so it's easier to see if we're doing the right
thing. That is, just call cmd_OptionAsString() without a conditional,
and just test if auditFileName is non-NULL later on, after options
processing.

Change-Id: I563c7efd02cb5210c32c0cc7f5a03683db792e98
Reviewed-on: https://gerrit.openafs.org/14402
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/bozo/bosserver.c