diff mbox series

[v3] libselinux: Add missing errno setup

Message ID 20200504103842.96472-1-rfilo@redhat.com (mailing list archive)
State Accepted
Headers show
Series [v3] libselinux: Add missing errno setup | expand

Commit Message

Richard Filo May 4, 2020, 10:38 a.m. UTC
Errno is not set to ENOENT when lookup_all() doesn't find any match.

fixes: https://src.fedoraproject.org/tests/selinux/issue/51

Signed-off-by: Richard Filo <rfilo@redhat.com>
---
	-removed check: result != NULL

 libselinux/src/label_file.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ondrej Mosnacek May 4, 2020, 11:08 a.m. UTC | #1
On Mon, May 4, 2020 at 12:39 PM Richard Filo <rfilo@redhat.com> wrote:
> Errno is not set to ENOENT when lookup_all() doesn't find any match.
>
> fixes: https://src.fedoraproject.org/tests/selinux/issue/51
>
> Signed-off-by: Richard Filo <rfilo@redhat.com>
> ---
>         -removed check: result != NULL
>
>  libselinux/src/label_file.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
> index 300625c2..74d2027e 100644
> --- a/libselinux/src/label_file.c
> +++ b/libselinux/src/label_file.c
> @@ -948,6 +948,8 @@ static const struct spec **lookup_all(struct selabel_handle *rec,
>                         goto finish;
>                 }
>         }
> +       if (!result[0])
> +               errno = ENOENT;
>
>  finish:
>         free(clean_key);
> --
> 2.25.2

Acked-by: Ondrej Mosnacek <omosnace@redhat.com>

Thanks!
Petr Lautrbach May 6, 2020, 2:10 p.m. UTC | #2
On Mon, May 04, 2020 at 01:08:33PM +0200, Ondrej Mosnacek wrote:
> On Mon, May 4, 2020 at 12:39 PM Richard Filo <rfilo@redhat.com> wrote:
> > Errno is not set to ENOENT when lookup_all() doesn't find any match.
> >
> > fixes: https://src.fedoraproject.org/tests/selinux/issue/51
> >
> > Signed-off-by: Richard Filo <rfilo@redhat.com>
> > ---
> >         -removed check: result != NULL
> >
> >  libselinux/src/label_file.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
> > index 300625c2..74d2027e 100644
> > --- a/libselinux/src/label_file.c
> > +++ b/libselinux/src/label_file.c
> > @@ -948,6 +948,8 @@ static const struct spec **lookup_all(struct selabel_handle *rec,
> >                         goto finish;
> >                 }
> >         }
> > +       if (!result[0])
> > +               errno = ENOENT;
> >
> >  finish:
> >         free(clean_key);
> > --
> > 2.25.2
> 
> Acked-by: Ondrej Mosnacek <omosnace@redhat.com>
> 
> Thanks!
> 

^&^ git am v3-libselinux-Add-missing-errno-setup.patch 
Applying: libselinux: Add missing errno setup
.git/rebase-apply/patch:15: trailing whitespace.
        if (!result[0]) 
warning: 1 line adds whitespace errors.

I have fixed the trailing whitespace and applied it.

Thanks.
diff mbox series

Patch

diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
index 300625c2..74d2027e 100644
--- a/libselinux/src/label_file.c
+++ b/libselinux/src/label_file.c
@@ -948,6 +948,8 @@  static const struct spec **lookup_all(struct selabel_handle *rec,
 			goto finish;
 		}
 	}
+	if (!result[0]) 
+		errno = ENOENT;
 
 finish:
 	free(clean_key);