Skip to content

Fail if verbose log can't be created - #2476

Open
jan-cerny wants to merge 1 commit into
OpenSCAP:mainfrom
jan-cerny:RHEL-295815
Open

jan-cerny wants to merge 1 commit into
OpenSCAP:mainfrom
jan-cerny:RHEL-295815

Conversation

@jan-cerny

Copy link
Copy Markdown
Member

When running oscap, if the --verbose-log-file points to a directory that does not exist, oscap runs, does nothing, and exits with 0 indicating no error. No error gets printed to the shell. The reason is incorrect handling of return value of oscap_set_verbose in oscap_module_process in utils/oscap-tool.c. Moreover, the error messages use the oscap_seterr doesn’t print anything because the error stack isn't printed on the failure path.

With this change, OpenSCAP will print an error message and terminate with 1 if a non-existing directory path is provided in the --verbose-log-file option.

Resolves: https://redhat.atlassian.net/browse/RHEL-295815

When running `oscap`, if the `--verbose-log-file` points to a directory
that does not exist, `oscap` runs, does nothing, and exits with 0
indicating no error. No error gets printed to the shell.  The reason is
incorrect handling of return value of `oscap_set_verbose` in
`oscap_module_process` in `utils/oscap-tool.c`.  Moreover, the error
messages use the `oscap_seterr` doesn’t print anything
because the error stack isn't printed on the failure path.

With this change, OpenSCAP will print an error message and terminate
with 1 if a non-existing directory path is provided in the
`--verbose-log-file` option.

Resolves: https://redhat.atlassian.net/browse/RHEL-295815
@jan-cerny jan-cerny added this to the 1.4.7 milestone Oct 30, 2026
@sonarqubecloud

Copy link
Copy Markdown

@Mab879 Mab879 self-assigned this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants