Skip to content

Commit bec3913

Browse files
committed
Prevent discarding const modifier
Addressing: /home/jcerny/openscap/src/XCCDF/xccdf_session.c: In function ‘_build_xccdf_result_source’: /home/jcerny/openscap/src/XCCDF/xccdf_session.c:1286:30: warning: passing argument 1 of ‘xccdf_benchmark_add_result’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 1286 | xccdf_benchmark_add_result(benchmark, cloned_result); | ^~~~~~~~~ In file included from /home/jcerny/openscap/src/XCCDF_POLICY/public/xccdf_policy.h:34, from /home/jcerny/openscap/src/OVAL/public/oval_agent_xccdf_api.h:41, from /home/jcerny/openscap/src/XCCDF/xccdf_session.c:38: /home/jcerny/openscap/src/XCCDF/public/xccdf_benchmark.h:3141:67: note: expected ‘struct xccdf_benchmark *’ but argument is of type ‘const struct xccdf_benchmark *’ 3141 | OSCAP_API bool xccdf_benchmark_add_result(struct xccdf_benchmark *bench, struct xccdf_result *result); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ /home/jcerny/openscap/src/XCCDF/xccdf_session.c:1287:64: warning: passing argument 1 of ‘xccdf_benchmark_export_source’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 1287 | session->xccdf.result_source = xccdf_benchmark_export_source(benchmark, session->export.xccdf_file); | ^~~~~~~~~ In file included from /home/jcerny/openscap/src/XCCDF_POLICY/public/xccdf_policy.h:34, from /home/jcerny/openscap/src/OVAL/public/oval_agent_xccdf_api.h:41, from /home/jcerny/openscap/src/XCCDF/xccdf_session.c:38: /home/jcerny/openscap/src/XCCDF/public/xccdf_benchmark.h:722:32: note: expected ‘struct xccdf_benchmark *’ but argument is of type ‘const struct xccdf_benchmark *’ 722 | OSCAP_API struct oscap_source *xccdf_benchmark_export_source(struct xccdf_benchmark *benchmark, const char *filename); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 parent e0e07d0 commit bec3913

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/XCCDF/xccdf_session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,7 @@ static int _build_xccdf_result_source(struct xccdf_session *session)
12751275

12761276
/* Build oscap_source of XCCDF TestResult only when needed */
12771277
if (session->export.xccdf_file != NULL || session->export.report_file != NULL || session->export.arf_file != NULL || session->export.xccdf_stig_viewer_file != NULL) {
1278-
const struct xccdf_benchmark *benchmark = xccdf_policy_model_get_benchmark(session->xccdf.policy_model);
1278+
struct xccdf_benchmark *benchmark = xccdf_policy_model_get_benchmark(session->xccdf.policy_model);
12791279

12801280
if (session->xccdf.result == NULL) {
12811281
// Attempt to export session before evaluation

0 commit comments

Comments
 (0)