Message ID | 20210314201651.474432-4-nicolas.iooss@m4x.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [1/6] libsepol/cil: fix out-of-bound read of a file context pattern ending with "\" | expand |
On Sun, Mar 14, 2021 at 4:22 PM Nicolas Iooss <nicolas.iooss@m4x.org> wrote: > > All functions of the CIL compiler use cil_log or cil_tree_log to report > errors, but in two places which still uses printf. Replace these printf > invocation with cil_tree_log. > > Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org> Acked-by: James Carter <jwcart2@gmail.com> > --- > libsepol/cil/src/cil_resolve_ast.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libsepol/cil/src/cil_resolve_ast.c b/libsepol/cil/src/cil_resolve_ast.c > index 47cdf0e7c0b9..2ea106d63505 100644 > --- a/libsepol/cil/src/cil_resolve_ast.c > +++ b/libsepol/cil/src/cil_resolve_ast.c > @@ -2497,7 +2497,7 @@ int cil_resolve_in(struct cil_tree_node *current, void *extra_args) > > rc = cil_copy_ast(db, current, block_node); > if (rc != SEPOL_OK) { > - printf("Failed to copy in, rc: %d\n", rc); > + cil_tree_log(current, CIL_ERR, "Failed to copy in-statement"); > goto exit; > } > > @@ -2788,7 +2788,7 @@ int cil_resolve_call1(struct cil_tree_node *current, void *extra_args) > macro_node = NODE(macro_datum); > > if (macro_node->flavor != CIL_MACRO) { > - printf("Failed to resolve %s to a macro\n", new_call->macro_str); > + cil_tree_log(current, CIL_ERR, "Failed to resolve %s to a macro", new_call->macro_str); > rc = SEPOL_ERR; > goto exit; > } > -- > 2.30.2 >
diff --git a/libsepol/cil/src/cil_resolve_ast.c b/libsepol/cil/src/cil_resolve_ast.c index 47cdf0e7c0b9..2ea106d63505 100644 --- a/libsepol/cil/src/cil_resolve_ast.c +++ b/libsepol/cil/src/cil_resolve_ast.c @@ -2497,7 +2497,7 @@ int cil_resolve_in(struct cil_tree_node *current, void *extra_args) rc = cil_copy_ast(db, current, block_node); if (rc != SEPOL_OK) { - printf("Failed to copy in, rc: %d\n", rc); + cil_tree_log(current, CIL_ERR, "Failed to copy in-statement"); goto exit; } @@ -2788,7 +2788,7 @@ int cil_resolve_call1(struct cil_tree_node *current, void *extra_args) macro_node = NODE(macro_datum); if (macro_node->flavor != CIL_MACRO) { - printf("Failed to resolve %s to a macro\n", new_call->macro_str); + cil_tree_log(current, CIL_ERR, "Failed to resolve %s to a macro", new_call->macro_str); rc = SEPOL_ERR; goto exit; }
All functions of the CIL compiler use cil_log or cil_tree_log to report errors, but in two places which still uses printf. Replace these printf invocation with cil_tree_log. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org> --- libsepol/cil/src/cil_resolve_ast.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)